commit de2e45710fa7b4bb211017de5e53ad80f65acf89
parent 4247fe8feea09744f1805e3979abc9ed27192f35
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Mon, 30 Aug 2021 20:35:18 -0700
Improve xenodm scripts
The global Xsession now simply finds and executes other programs
and Xsetup_0 does what it used to do but is much easier to read.
Diffstat:
3 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/global/xenodm/etc/X11/xenodm/Xsession b/global/xenodm/etc/X11/xenodm/Xsession
@@ -1,24 +1,18 @@
#!/bin/sh
# Copyright 2021 Jacob R. Edwards
# License: GPLv3
-#
# Xsession -- Initialize X session
-#
-# If the xsession directory in $XDG_DATA_HOME exists output is
-# redirected to a file within it. A configuration script must
-# exist, it must be within either $XDG_CONFIG_HOME/xenodm,
-# $HOME/.xenodm, or $HOME/.xinitrc.
-test -f "$HOME/.profile" && . "$HOME/.profile"
-
-datadir="${XDG_DATA_HOME:-$HOME/.local/share}/xsession"
-configs="${XDG_CONFIG_HOME:-$HOME/.config}/xsession $HOME/.xsession $HOME/.xinitrc"
+try() { test -x "$1" && exec "$@"; }
-config="$(stest -e $configs | /usr/bin/sed 1q)"
-test -z "$config" && {
- printf 'Xsession: %s: No such file or directory.\n' $configs 1>&2
- exit 1
-}
+test -f "$HOME/.profile" && . "$HOME/.profile"
-test -d "$datadir" && exec 2>&1 >"$datadir/log"
-exec /bin/sh "$config"
+try "${XDG_CONFIG_HOME:-$HOME/.config}/xsession"
+try "$HOME/lib/xsession"
+try "$HOME/lib/xinitrc"
+try "$HOME/.xsession"
+try "$HOME/.xinitrc"
+try "$(which dwm)"
+try "$(which rio)"
+try "$(which twm)"
+exit 1
diff --git a/global/xenodm/etc/X11/xenodm/Xsetup_0 b/global/xenodm/etc/X11/xenodm/Xsetup_0
@@ -1,11 +1,8 @@
#!/bin/sh
# OpenBSD xenodm(1) Xsetup_0
-if test -x /usr/local/bin/xwallpaper &&
- test -s /etc/X11/xenodm/background; then
- /usr/local/bin/xwallpaper --zoom /etc/X11/xenodm/background
-elif test -x /usr/local/bin/openbsd-wallpaper; then
- /usr/local/bin/openbsd-wallpaper
-else
- xsetroot -solid black
-fi
+PATH=/usr/local/bin:/usr/X11R6/bin
+
+xwallpaper --zoom /etc/X11/xenodm/pixmaps/wallpaper ||
+ openbsd-wallpaper ||
+ xsetroot -solid black
diff --git a/local/xenodm/.config/xsession b/local/xenodm/.config/xsession
@@ -1,4 +1,5 @@
-# xinit rc file
+#!/bin/sh
+# Initialize X
bg() { "$@" & }