-
Notifications
You must be signed in to change notification settings - Fork 28
/
.xinitrc
97 lines (78 loc) · 1.72 KB
/
.xinitrc
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
# vim:ts=4:sw=4:expandtab:ft=sh
session=${1:-i3wm}
echo ">>> Starting $session..."
export GLFW_IM_MODULE=ibus
export GTK_IM_MODULE=fcitx
export INPUT_METHOD=fcitx
export QT_IM_MODULE=fcitx
export SDL_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
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/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
xrdb -load ~/.Xresources
xsetroot -cursor_name left_ptr
xset s off
xset -dpms
xset s noblank
xset r rate 200 20
setxkbmap us
setxkbmap -option ctrl:nocaps
xmodmap -e 'clear lock'
xmodmap -e 'keycode 66 = Hyper_L'
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap
setup_i3() {
log_dir=~/Logs
mkdir -p $log_dir
log_file=$log_dir/i3log-$(date -Id)
if grep '^set $mod ' ~/.config/i3/config; then
i3config=~/.config/i3/config
else
i3config=~/.config/i3/config.working
cat >$i3config <<EOF
# vim:set noet ft=i3config:
# Don't modify this file unless you know what you are doing
EOF
if grep 'HHKB' /proc/bus/input/devices; then
echo 'set $mod Mod1' >>$i3config
else
echo 'set $mod Mod4' >>$i3config
fi
fi
echo 'include ~/.config/i3/config' >>$i3config
exec i3 -c $i3config -V >>$log_file 2>&1
}
case $session in
i3 | i3wm)
setup_i3
;;
xfce | xfce4)
exec startxfce4
;;
*)
echo ">> Executing: $@"
exec "$@"
;;
esac