aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2022-08-14 14:03:52 +1200
committerTom Ryder <tom@sanctum.geek.nz>2022-08-14 16:20:22 +1200
commit02d8c2c6784b49765c0a279f07148adfd6ab8f5d (patch)
tree5e3beec52b7443049d552dce14a31e684fa7b3a4
parentRevert "Refactor X startup to accomodate differ... (diff)
downloaddotfiles-02d8c2c6784b49765c0a279f07148adfd6ab8f5d.tar.gz
dotfiles-02d8c2c6784b49765c0a279f07148adfd6ab8f5d.zip
Reorganize X11 startup file again
I swear I'm going to figure this out.
-rw-r--r--Makefile46
-rw-r--r--check/x.sh2
-rw-r--r--check/xsession.sh1
-rw-r--r--lint/x.sh2
-rw-r--r--lint/xsession.sh1
-rw-r--r--x/xprofile3
-rw-r--r--x/xsession.sh49
-rw-r--r--x/xsessionrc17
8 files changed, 80 insertions, 41 deletions
diff --git a/Makefile b/Makefile
index 16e51e4a..96189a73 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,7 @@
install-vint \
install-wget \
install-x \
+ install-xsession \
install-yt-dlp \
install-zsh \
check \
@@ -69,6 +70,7 @@
check-sh \
check-urxvt \
check-x \
+ check-xsession \
check-zsh \
lint \
lint-bash \
@@ -79,7 +81,8 @@
lint-sh \
lint-urxvt \
lint-vim \
- lint-x
+ lint-x \
+ lint-xsession
.SUFFIXES:
.SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh
@@ -416,7 +419,7 @@ install-cpanm:
install-curl:
cp -p -- curl/curlrc $(HOME)/.curlrc
-install-dillo: dillo/dillorc install-x
+install-dillo: dillo/dillorc
mkdir -p -- $(HOME)/.dillo
cp -p -- dillo/dillorc $(HOME)/.dillo/dillorc
@@ -457,7 +460,8 @@ install-gnupg: gnupg/profile.d/gnupg.sh install-sh
install-i3: install-x
mkdir -p -- $(XDG_CONFIG_HOME)/i3
- cp -p -- i3/* $(XDG_CONFIG_HOME)/i3
+ cp -p -- i3/config $(XDG_CONFIG_HOME)/i3
+ cp -p -- i3/status $(XDG_CONFIG_HOME)/i3
install-init:
if test -d /run/systemd/system ; then make install-systemd ; fi
@@ -531,7 +535,7 @@ install-login-shell: check-login-shell
install-parcellite: install-x
cp -p -- parcellite/parcelliterc $(XDG_CONFIG_HOME)
- cp -p -- redshift/xsession.d/* $(HOME)/.xsession.d
+ cp -p -- redshift/xsession.d/redshift.sh $(HOME)/.xsession.d
install-perlcritic: install-sh
cp -p -- perlcritic/profile.d/*.sh $(HOME)/.profile.d
@@ -563,7 +567,7 @@ install-readline:
install-redshift: install-x
cp -p -- redshift/redshift.conf $(XDG_CONFIG_HOME)
- cp -p -- redshift/xsession.d/* $(HOME)/.xsession.d
+ cp -p -- redshift/xsession.d/redshift.sh $(HOME)/.xsession.d
install-scrot:
mkdir -p -- $(XDG_DATA_HOME)/scrot/screenshots
@@ -583,7 +587,7 @@ install-subversion:
install-sxhkd: install-scrot install-x
mkdir -p -- $(XDG_CONFIG_HOME)/sxhkd
cp -p -- sxhkd/sxhkdrc $(XDG_CONFIG_HOME)/sxhkd
- cp -p -- sxhkd/xsession.d/* $(HOME)/.xsession.d
+ cp -p -- sxhkd/xsession.d/sxhkd.sh $(HOME)/.xsession.d
install-systemd: install-sh
cp -p -- systemd/profile.d/*.sh $(HOME)/.profile.d
@@ -627,8 +631,7 @@ install-tmux: tmux/bin/tmux tmux/tmux.conf install-systemd install-terminfo
install-urxvt: urxvt/ext/select install-x
mkdir -p -- $(HOME)/.urxvt/ext
cp -p -- urxvt/ext/select $(HOME)/.urxvt/ext
- cp -p -- urxvt/Xresources.d/* $(HOME)/.Xresources.d
- cp -p -- urxvt/xsession.d/* $(HOME)/.xsession.d
+ cp -p -- urxvt/xsession.d/urxvt.sh $(HOME)/.xsession.d
VIM = vim
VIMDIR = $(HOME)/.vim
@@ -667,18 +670,15 @@ install-wget: install-sh
mkdir -p -- $(XDG_CACHE_HOME)/wget $(XDG_CONFIG_HOME)/wget
cp -p -- wget/wgetrc $(XDG_CONFIG_HOME)/wget/wgetrc
-install-x: x/xsession check-x install-logrotate install-sh
- mkdir -p -- \
- $(HOME)/.xsession.d \
- $(HOME)/.Xresources.d \
- $(XDG_CONFIG_HOME)/log/xsession
- cp -p -- x/xprofile $(HOME)/.xprofile
- cp -p -- x/xsession $(HOME)/.xsession
- cp -p -- x/xsessionrc $(HOME)/.xsessionrc
+install-x: check-x install-logrotate install-sh
cp -p -- x/Xresources $(HOME)/.Xresources
- cp -p -- x/Xresources.d/* $(HOME)/.Xresources.d
- cp -p -- x/logrotate/config.d/* $(XDG_CONFIG_HOME)/logrotate/config.d
- cp -p -- x/shrc.d/*.sh $(HOME)/.shrc.d
+ mkdir -p -- $(HOME)/.xsession.d
+ cp -p -- x/shrc.d/x.sh $(HOME)/.shrc.d
+ mkdir -p -- $(XDG_CONFIG_HOME)/log/xsession
+ cp -p -- x/logrotate/config.d/xsession $(XDG_CONFIG_HOME)/logrotate/config.d
+
+install-xsession: x/xsession check-xsession install-x
+ cp -p -- x/xsession $(HOME)/.xsession
install-yt-dlp install-youtube-dl:
mkdir -p -- $(XDG_CONFIG_HOME)/yt-dlp
@@ -724,9 +724,12 @@ check-sh:
check-urxvt: urxvt/ext/select
sh check/urxvt.sh
-check-x: x/xsession
+check-x:
sh check/x.sh
+check-xsession: x/xsession
+ sh check/xsession.sh
+
check-zsh:
sh check/zsh.sh
@@ -766,3 +769,6 @@ lint-vim:
lint-x: check-x
sh lint/x.sh
+
+lint-xsession: x/xsession check-xsession
+ sh lint/xsession.sh
diff --git a/check/x.sh b/check/x.sh
index b3ed21ef..f88f11a1 100644
--- a/check/x.sh
+++ b/check/x.sh
@@ -1 +1 @@
-sh -n -- x/xprofile x/xsession x/shrc.d/*.sh
+sh -n -- x/xsessionrc x/shrc.d/*.sh
diff --git a/check/xsession.sh b/check/xsession.sh
new file mode 100644
index 00000000..0b72d8a6
--- /dev/null
+++ b/check/xsession.sh
@@ -0,0 +1 @@
+sh -n -- x/xsession
diff --git a/lint/x.sh b/lint/x.sh
index 25fdf58d..0625369b 100644
--- a/lint/x.sh
+++ b/lint/x.sh
@@ -1 +1 @@
-shellcheck -e SC1090 -e SC1091 -s sh -- x/xprofile x/xsession x/shrc.d/*.sh
+shellcheck -e SC1090 -e SC1091 -s sh -- x/xsessionrc x/shrc.d/*.sh
diff --git a/lint/xsession.sh b/lint/xsession.sh
new file mode 100644
index 00000000..5544e1be
--- /dev/null
+++ b/lint/xsession.sh
@@ -0,0 +1 @@
+shellcheck -e SC1090 -e SC1091 -s sh -- x/xsession
diff --git a/x/xprofile b/x/xprofile
deleted file mode 100644
index 1750c70b..00000000
--- a/x/xprofile
+++ /dev/null
@@ -1,3 +0,0 @@
-# Read ~/.profile to set up environment when starting X with a display manager
-# like LightDM, since we didn't have a TTY login arrange that already
-. "$HOME"/.profile
diff --git a/x/xsession.sh b/x/xsession.sh
index 6b298048..e0552315 100644
--- a/x/xsession.sh
+++ b/x/xsession.sh
@@ -1,8 +1,20 @@
-# Custom X session to fit into Debian's way of doing things
-
-# Load common environment variables
-# shellcheck disable=SC1091
-. "$HOME"/.xprofile
+#
+# Custom i3wm X session to fit into Debian's way of doing things, for use with
+# startx(1) or xinit(1). From Debian's `man 1 startx` (xinit dpkg 1.4.0-1):
+#
+# > Note that in the Debian system, what many people traditionally put in the
+# > .xinitrc file should go in .xsession instead; this permits the same X
+# > environment to be presented whether startx, xdm, or xinit is used to start
+# > the X session. All discussion of the .xinitrc file in the xinit(1) manual
+# > page applies equally well to .xsession.
+#
+# This turns out to be important for having the X session wrappers in /etc/X11
+# on Debian-derived systems do things like dbus daemon and accessibility setup.
+#
+# At the time of writing, none of my machines running X are using anything
+# other than the Debian-derived X startup script layout, so we'll just conform
+# to that unless and until I actually need to abstract this.
+#
# 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
@@ -30,14 +42,20 @@ xset \
mouse 5/2 0 \
s off
-# Start a few daemons if we can; it's OK if they don't exist, but log the
-# failed attempt to start them to the errors file.
-## compton: Display compositor
-compton -b &
-## dunst: Message display (libnotify)
-dunst &
-## unclutter: Hide mouse after inactivity (but not on root window)
-unclutter -idle 5 &
+# Start a few daemons if we can; it's OK if any of these don't exist, but we'll
+# log the failed attempt to start them to the errors file, as a hint that
+# I might want to install them.
+#
+(
+ # Display compositor
+ compton
+ # Message display (libnotify)
+ dunst
+ # PulseAudio system tray tool
+ pasystray
+ # Hide mouse after inactivity
+ unclutter
+) &
# Load all supplementary scripts in ~/.xsession.d
for sh in "$HOME"/.xsession.d/*.sh ; do
@@ -46,6 +64,5 @@ for sh in "$HOME"/.xsession.d/*.sh ; do
done
unset -v sh
-# Start Debian's configured window manager now that everything's ready; at the
-# time of writing, this is normally i3wm
-exec x-window-manager
+# Become an i3 window manager process, having set everything else up
+exec i3
diff --git a/x/xsessionrc b/x/xsessionrc
new file mode 100644
index 00000000..8d46ed0b
--- /dev/null
+++ b/x/xsessionrc
@@ -0,0 +1,17 @@
+# X startup commands go in here if they should run on every X session, whether
+# classic `startx` or a modern DE like LightDM. xsessionrc is a dpkg-specific
+# file.
+#
+
+# If $ENV isn't set, then this X startup process wasn't started from somewhere
+# beneath a login shell that sources ~/.profile to set up environment variables
+# yet, most likely because it's being opened by a display manager, so we'll do
+# it here.
+#
+if [ -z "$ENV" ] ; then
+ . "$HOME"/.profile
+fi
+
+# Update BROWSER, since .profile has already set this to a curses browser
+# shellcheck disable=SC2034
+BROWSER=x-www-browser