gnome-settings-daemon/patches/debian/01_debianize_xrdb.patch

59 lines
1.6 KiB
Diff
Raw Normal View History

2024-08-13 18:10:50 +02:00
From: Laurent Bigonville <bigon@debian.org>
Date: Thu, 12 Mar 2020 18:05:51 +0100
Subject: Debianize the 00-xrdb script
In Debian, /etc/X11/Xresources is a directory, processing of ~/.Xresources
is controlled by /etc/X11/Xsession.options, and xrdb is not a mandatory
dependency.
Forwarded: not-needed, Debian-specific
---
plugins/xsettings/00-xrdb | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/plugins/xsettings/00-xrdb b/plugins/xsettings/00-xrdb
index a047e8b..7fc8492 100755
--- a/plugins/xsettings/00-xrdb
+++ b/plugins/xsettings/00-xrdb
@@ -1,9 +1,35 @@
#!/bin/sh
-userresources=$HOME/.Xresources
-sysresources=/etc/X11/Xresources
+# This script mimic what /etc/X11/Xsession.d/30x11-common_xresources is doing
+# but for Xwayland
-# merge in defaults
-[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
-[ -r "$userresources" ] && xrdb -merge "$userresources"
+USRRESOURCES=$HOME/.Xresources
+SYSRESOURCES=/etc/X11/Xresources
+OPTIONFILE=/etc/X11/Xsession.options
+# read OPTIONFILE
+OPTIONS=$(cat "$OPTIONFILE") || true
+
+has_option() {
+ if [ "${OPTIONS#*
+$1}" != "$OPTIONS" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if [ -d "$SYSRESOURCES" ] && which xrdb >/dev/null 2>&1; then
+ RESOURCEFILES=$(run-parts --list $SYSRESOURCES)
+ if [ -n "$RESOURCEFILES" ]; then
+ for RESOURCEFILE in $RESOURCEFILES; do
+ xrdb -merge $RESOURCEFILE
+ done
+ fi
+fi
+
+if has_option allow-user-resources && [ -f "$USRRESOURCES" ]; then
+ if which xrdb >/dev/null 2>&1; then
+ xrdb -merge $USRRESOURCES
+ fi
+fi