diff options
Diffstat (limited to 'X/xsession.sh')
-rwxr-xr-x | X/xsession.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/X/xsession.sh b/X/xsession.sh new file mode 100755 index 00000000..daef7e42 --- /dev/null +++ b/X/xsession.sh @@ -0,0 +1,47 @@ +# 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 + +# 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 + +# Set a few keyboard map options +# - Remap right Alt as a Compose key +# - Remap Caps Lock as another Control key +# - Kill X server with Ctrl+Alt+Backspace +setxkbmap \ + -option compose:ralt \ + -option ctrl:nocaps \ + -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 +export BROWSER + +# 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 |