aboutsummaryrefslogtreecommitdiff
path: root/x/xsession.sh
blob: 0ef2615aa9f104e92517505fe24951752e9140a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Custom 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 &

# Update browser, since .profile set this to a curses browser on login
# shellcheck disable=SC2034
BROWSER=x-www-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 Debian's configured window manager now that everything's ready; at the
# time of writing, this is normally i3wm
exec x-session-manager