xdg-utils/0001-Check-for-WAYLAND_DISPLAY-as-well-as-DISPLAY.patch
2016-04-15 08:51:43 -05:00

116 lines
3.6 KiB
Diff

From e6db37b89d90c10b31474ee8fbe4b24f77bb7c99 Mon Sep 17 00:00:00 2001
From: Per Olofsson <pelle@debian.org>
Date: Tue, 3 Nov 2015 20:34:44 +0100
Subject: [PATCH 1/9] Check for $WAYLAND_DISPLAY as well as $DISPLAY.
---
ChangeLog | 6 ++++++
scripts/xdg-email.in | 2 +-
scripts/xdg-mime.in | 2 +-
scripts/xdg-open.in | 8 ++++----
scripts/xdg-utils-common.in | 12 ++++++++++++
5 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2682c71..b0d8e2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
+}
--
2.7.3