aboutsummaryrefslogtreecommitdiff
path: root/X
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2022-05-01 00:52:53 +1200
committerTom Ryder <tom@sanctum.geek.nz>2022-05-01 00:52:53 +1200
commit6149431a6763d3fc42cf79b518462510f41dd359 (patch)
tree80b108d03080f07f2021220f1aa938cbb4cb9b5a /X
parentRemove long-unneeded `make clean` deletion (diff)
downloaddotfiles-6149431a6763d3fc42cf79b518462510f41dd359.tar.gz
dotfiles-6149431a6763d3fc42cf79b518462510f41dd359.zip
Handle monitor and wallpaper setup with config
Diffstat (limited to 'X')
-rw-r--r--[-rwxr-xr-x]X/xsession.sh35
1 files changed, 19 insertions, 16 deletions
diff --git a/X/xsession.sh b/X/xsession.sh
index daef7e42..ccc3a343 100755..100644
--- a/X/xsession.sh
+++ b/X/xsession.sh
@@ -1,20 +1,23 @@
-# If a file ~/.xrandrrc exists for monitor setup, source that first of all and
-# wait for it to finish, so that window geometries and monitor order make sense
-# for the rest of the session setup.
-#
-# shellcheck disable=SC1091
-if [ -e "$HOME"/.xrandrrc ] ; then
- . "$HOME"/.xrandrrc
-fi
+# Custom i3wm X session to fit into Debian's way of doing things
-# Set the background, one of two ways:
-## 1. If there's a ~/.fehbg from a prior run, just re-run that
-if [ -x "$HOME"/.fehbg ] ; then
- "$HOME"/.fehbg &
-## 2. Otherwise, apply a random background image, if the relevant dir exists
-elif [ -d "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}" ] ; then
- xrbg &
-fi
+# Monitor and wallpaper setup is very machine-specific, and isn't versioned in
+# here. Neither xrandr(1) nor xwallpaper(1) have config files, so we fake it
+# with xargs and looking for a file with argument tokens to read in
+# XDG_CONFIG_HOME, which will almost always be:
+#
+# - ~/.config/xrandr/config
+# - ~/.config/xwallpaper/config
+#
+# We figure each one out in a subshell, so that we can use a temporary variable
+# for the configuration path without polluting the namespace of the rest of
+# this script.
+#
+for program in xrandr xwallpaper ; do (
+ command -v "$program" >/dev/null 2>&1 || exit
+ config=${XDG_CONFIG_HOME:-"$HOME"/.config}/"$program"/config
+ [ -e "$config" ] || exit
+ xargs "$program" < "$config"
+) ; done
# Set a few keyboard map options
# - Remap right Alt as a Compose key