xinitrc/xinitrc

96 lines
2.5 KiB
Bash

#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
if [ -f "$HOME/.xinitrc.extend" ] ; then
. "$HOME/.xinitrc.extend"
fi
if [ -f "$HOME/.screenlayout/layout.sh" ] ; then
. "$HOME/.screenlayout/layout.sh"
elif [ -f "$HOME/.config/randr/randr.sh" ] ; then
. "$HOME/.config/randr/randr.sh" &
elif [ -f "$HOME/.config/randr.sh" ] ; then
. "$HOME/.config/randr.sh" &
elif [ -f "$HOME/randr.sh" ] ; then
. "$HOME/randr.sh" &
fi
if [ -x "$(command -v unclutter)" ] ; then
unclutter --timeout 1 &
fi
setxkbmap gb,ru -option grp:shifts_toggle
# mouse acceleration off
xset m 0 0
# keyboard repeat rate
xset r rate 200 50
# reassign AltGR to Super_L
xmodmap -e "keycode 108 = Super_L"
xinput 'HAILUCK CO.,LTD USB KEYBOARD Mouse' 'libinput Middle Emulation Enabled' 1
xinput 'HAILUCK CO.,LTD USB KEYBOARD Mouse' 'libinput Scroll Method Enabled' 0 0 1
# disable DPMS and screensaving - doesn't work without a dely
# TODO does this now work with a dely?
(sleep 5s && xset s off -dpms) &
if command -v sxhkd ; then
sxhkd -c ~/.config/sxhkd/sxhkdrc ~/.config/sxhkd/sxhkdrc.bspwm ~/.config/sxhkd/sxhkdrc.bspwm.machineone &
fi
if [ -f "$HOME/.config/feh/fehbg" ] ; then
"$HOME/.config/feh/fehbg" &
fi
# fix giant cursors caused by adwaitu theme being installed as dependency of something.
# not working on machineone for some reason so workaround is to
# comment out `Inherits=Adwaita` in `/usr/share/icons/default/index.theme`
export XCURSOR_PATH=""
_host=$(hostname)
case "$_host" in
MachineOne)
barriers --no-tray --debug ERROR --name MachineOne -c ~/.config/barrier/barrier.conf --disable-crypto --disable-client-cert-checking --address 192.168.0.10:24800 &
sleep 3 && "$HOME/.config/bspwm/border_flash.sh" &
;;
MachineTwo)
# nvidia drivers xrandr settings
# barrier client only works with a sleep (behaves as if Mod4 key is always being pressed) - why?
# sleep 5 && barrierc --no-tray --debug ERROR --name MachineTwo 192.168.8.10:24800 &
;;
esac
xsetroot -solid "#$(openssl rand -hex 3)" &
bspwm