dotfiles/x/xinitrc
2022-06-12 17:17:44 +01:00

69 lines
1.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
# start some nice programs
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
# CUSTOM
# Set external monitor config (dependent on monitor connected)
# For ThinkPad X220
if [[ "$(xrandr | awk '/^VGA/ { print $2 }')" == "connected" ]]; then
xrandr --output VGA1 --primary --above LVDS1
elif [[ "$(xrandr | awk '/^DP1/ { print $2 }')" == "connected" ]];then
xrandr --output DP1 --primary --above LVDS1
else :
fi
# For ThinkPad T15
if [[ "$(xrandr | awk '/^VGA/ { print $2 }')" == "connected" ]]; then
xrandr --output VGA1 --primary --above eDP1
elif [[ "$(xrandr | awk '/^DP1/ { print $2 }')" == "connected" ]];then
xrandr --output DP1 --primary --above eDP1
elif [[ "$(xrandr | awk '/^HDMI1/ { print $2 }')" == "connected" ]];then
xrandr --output HDMI1 --above eDP1
else :
fi
# Set UK keyboard
setxkbmap gb
# Set custom keybindings
xmodmap ~/.Xmodmap
# Set background
feh --bg-fill /home/thomas/wallpapers/arpanet/svg/green.svg
# Start i3 window manager
exec i3