diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-05-06 16:30:04 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-05-06 23:54:41 +1200 |
commit | 89b54c73f11c77c20266170213b8894db78accf4 (patch) | |
tree | 25938657fcdc86539c256ce5493d1f793d347375 | |
parent | Add log rotation support for .xsession (diff) | |
download | dotfiles-89b54c73f11c77c20266170213b8894db78accf4.tar.gz dotfiles-89b54c73f11c77c20266170213b8894db78accf4.zip |
Rename X dir to x for consistency
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | check/xsession.sh | 2 | ||||
-rw-r--r-- | lint/xsession.sh | 2 | ||||
-rw-r--r-- | x/Xresources (renamed from X/Xresources) | 0 | ||||
-rw-r--r-- | x/Xresources.d/XTerm (renamed from X/Xresources.d/XTerm) | 0 | ||||
-rwxr-xr-x | x/bin/xsession | 53 | ||||
-rw-r--r-- | x/bin/xsession.sh (renamed from X/xsession.sh) | 0 | ||||
-rw-r--r-- | x/logrotate/config.d/config (renamed from X/logrotate/config.d/config) | 0 |
9 files changed, 64 insertions, 11 deletions
@@ -186,4 +186,4 @@ /less/less /mutt/filters/markdown-to-html /urxvt/ext/select -/X/xsession +/x/bin/xsession @@ -278,7 +278,7 @@ all: $(BINS) \ git/config \ gnupg/profile.d/gnupg.sh \ less/less \ - X/xsession + x/xsession clean distclean: rm -f -- \ @@ -297,7 +297,7 @@ clean distclean: less/less \ mutt/filters/markdown-to-html \ urxvt/ext/select \ - X/xsession + x/xsession .awk: sh bin/shb.sh awk -f < $< > $@ @@ -658,15 +658,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-xsession install-logrotate +install-x: x/xsession check-xsession install-logrotate mkdir -p -- \ $(HOME)/.xsession.d \ $(HOME)/.Xresources.d \ $(XDG_CONFIG_HOME)/log/xsession - cp -p -- X/xsession $(HOME)/.xsession - 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/xsession $(HOME)/.xsession + 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 touch -- $(XDG_CONFIG_HOME)/log/xsession/errors.log chmod -- 0600 $(XDG_CONFIG_HOME)/log/xsession/errors.log if [ -e $(HOME)/.xsession-errors ] && ! [ -h $(HOME)/.xsession-errors ] ; then \ @@ -717,7 +717,7 @@ check-sh: check-urxvt: urxvt/ext/select sh check/urxvt.sh -check-xsession: X/xsession +check-xsession: x/xsession sh check/xsession.sh check-zsh: diff --git a/check/xsession.sh b/check/xsession.sh index 66ed611f..0b72d8a6 100644 --- a/check/xsession.sh +++ b/check/xsession.sh @@ -1 +1 @@ -sh -n -- X/xsession +sh -n -- x/xsession diff --git a/lint/xsession.sh b/lint/xsession.sh index 4aa5c7ca..dc291fd3 100644 --- a/lint/xsession.sh +++ b/lint/xsession.sh @@ -1 +1 @@ -shellcheck -e SC1090 -s sh -- X/xsession +shellcheck -e SC1090 -s sh -- x/xsession diff --git a/X/Xresources b/x/Xresources index 3f586a87..3f586a87 100644 --- a/X/Xresources +++ b/x/Xresources diff --git a/X/Xresources.d/XTerm b/x/Xresources.d/XTerm index f991ec91..f991ec91 100644 --- a/X/Xresources.d/XTerm +++ b/x/Xresources.d/XTerm diff --git a/x/bin/xsession b/x/bin/xsession new file mode 100755 index 00000000..e3de5751 --- /dev/null +++ b/x/bin/xsession @@ -0,0 +1,53 @@ +#!/usr/bin/sh +# Custom i3wm X session to fit into Debian's way of doing things + +# 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 Caps Lock as another Control key +# - Remap right Alt as a Compose key +# - Kill X server with Ctrl+Alt+Backspace +setxkbmap \ + -option caps:ctrl_modifier \ + -option compose:ralt \ + -option terminate:ctrl_alt_bksp & + +# Set fast mouse acceleration with a natural threshold +xset mouse 5/2 0 & + +# Pick a GUI browser, depending on availability +if command -v librewolf >/dev/null 2>&1 ; then + BROWSER=librewolf +elif command -v firefox >/dev/null 2>&1 ; then + BROWSER=firefox +fi +if [ -n "$BROWSER" ] ; then + export BROWSER +fi + +# Load all supplementary scripts in ~/.xsession.d +for sh in "$HOME"/.xsession.d/*.sh ; do + [ -e "$sh" ] || continue + . "$sh" +done +unset -v sh + +# Start i3 window manager now that everything's ready +exec i3 diff --git a/X/xsession.sh b/x/bin/xsession.sh index 76cbc85b..76cbc85b 100644 --- a/X/xsession.sh +++ b/x/bin/xsession.sh diff --git a/X/logrotate/config.d/config b/x/logrotate/config.d/config index c0b1b51b..c0b1b51b 100644 --- a/X/logrotate/config.d/config +++ b/x/logrotate/config.d/config |