diff options
author | Per Olofsson <pelle@debian.org> | 2015-11-03 20:34:44 +0100 |
---|---|---|
committer | Per Olofsson <pelle@debian.org> | 2015-11-03 20:34:44 +0100 |
commit | e6db37b89d90c10b31474ee8fbe4b24f77bb7c99 (patch) | |
tree | 065c2f98e80ca6d02ee92c11a48d129aa9d6623b | |
parent | ef8a58be4049697bb6347c3c5b8fff4d2b2deb86 (diff) |
Check for $WAYLAND_DISPLAY as well as $DISPLAY.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | scripts/xdg-email.in | 2 | ||||
-rw-r--r-- | scripts/xdg-mime.in | 2 | ||||
-rw-r--r-- | scripts/xdg-open.in | 8 | ||||
-rw-r--r-- | scripts/xdg-utils-common.in | 12 |
5 files changed, 24 insertions, 6 deletions
@@ -1,3 +1,9 @@ +=== xdg-utils 1.1.2 === + +2015-11-03 Per Olofsson <pelle@debian.org> + * Check for $WAYLAND_DISPLAY as well as $DISPLAY. Move display checking + to a common has_display() function. Thanks to Pasi Sjöholm for reporting. + === xdg-utils 1.1.1 === 2015-10-05 Per Olofsson <pelle@debian.org> diff --git a/scripts/xdg-email.in b/scripts/xdg-email.in index 2819e28..9d1701d 100644 --- a/scripts/xdg-email.in +++ b/scripts/xdg-email.in @@ -433,7 +433,7 @@ fi # if BROWSER variable is not set, check some well known browsers instead if [ x"$BROWSER" = x"" ]; then BROWSER=www-browser:links2:elinks:links:lynx:w3m - if [ -n "$DISPLAY" ]; then + if has_display; then BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER fi fi diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in index 074256c..129850f 100644 --- a/scripts/xdg-mime.in +++ b/scripts/xdg-mime.in @@ -32,7 +32,7 @@ _USAGE update_mime_database() { - if [ x"$mode" = x"user" -a -n "$DISPLAY" ] ; then + if [ "$mode" = user ] && has_display; then detectDE if [ x"$DE" = x"kde" ] ; then DEBUG 1 "Running kbuildsycoca" diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in index 0fbd63d..92a5912 100644 --- a/scripts/xdg-open.in +++ b/scripts/xdg-open.in @@ -348,7 +348,7 @@ open_generic() check_input_file "$file" - if [ -n "$DISPLAY" ]; then + if has_display; then filetype=`xdg-mime query filetype "$file" | sed "s/;.*//"` open_generic_xdg_mime "$file" "$filetype" fi @@ -360,7 +360,7 @@ open_generic() fi fi - if [ -n "$DISPLAY" ] && mimeopen -v 2>/dev/null 1>&2; then + if has_display && mimeopen -v 2>/dev/null 1>&2; then mimeopen -L -n "$file" if [ $? -eq 0 ]; then exit_success @@ -372,14 +372,14 @@ open_generic() open_envvar "$1" fi - if [ -n "$DISPLAY" ]; then + if has_display; then open_generic_xdg_x_scheme_handler "$1" fi # if BROWSER variable is not set, check some well known browsers instead if [ x"$BROWSER" = x"" ]; then BROWSER=www-browser:links2:elinks:links:lynx:w3m - if [ -n "$DISPLAY" ]; then + if has_display; then BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER fi fi diff --git a/scripts/xdg-utils-common.in b/scripts/xdg-utils-common.in index f920799..cb70875 100644 --- a/scripts/xdg-utils-common.in +++ b/scripts/xdg-utils-common.in @@ -350,3 +350,15 @@ kfmclient_fix_exit_code() test "$release" -gt 4 && return $1 return 0 } + +#---------------------------------------------------------------------------- +# Returns true if there is a graphical display attached. + +has_display() +{ + if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then + return 0 + else + return 1 + fi +} |