dotfiles/.xsession

73 lines
1.4 KiB
Bash

#!/bin/sh -x
cleanup() {
echo "Cleaning up..."
pkill dbus-daemon picom xbanish xidle
kill $display_switcher_pid
kill $battery_notifier_pid
rm -f ~/.Xauthority
rm -f ~/*.core
rm -rf ~/.local/share/Trash
}
trap cleanup INT TERM QUIT
export MOZ_USE_XINPUT2=1
export MOZ_ACCELERATED=1
export MOZ_WEBRENDER=1
export LANG=en_US.UTF-8
export PATH=$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_ENABLE_HIGHDPI_SCALING=1
export QT_SCALE_FACTOR=0.5
export NO_COLOR=1
# Load Xresources
xrdb < ~/.Xresources
# Start display switcher
~/.cwm_scripts/display-switcher &
display_switcher_pid=$!
# Start battery notifier
~/.cwm_scripts/battery-notifier &
battery_notifier_pid=$!
# Set desktop background
hsetroot -solid darkgrey
# No bell
xset -b
# Map right alt to compose key
setxkbmap -option "compose:ralt"
# Map CapsLock to Control_L
setxkbmap -option "ctrl:nocaps"
# Launch DBUS for programs which need it
eval `dbus-launch --sh-syntax`
# Compositor
picom -b
# Hide cursor when typing
xbanish -i all &
# Auto-lock / auto-off screen
xidle -program "/usr/X11R6/bin/xlock -mode dclock -ncolors 2" -timeout 1800 &
xset dpms 1800 1800 1800
# Mute audio
sndioctl -q output.mute=1
# Launch applications
xterm -e "tmux attach || tmux" &
firefox &
thunderbird &
keepassxc &
# Launch WM and block
cwm
# Run cleanup function on exit
cleanup