aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm/autostart
blob: 75ecf9bb7ec0b1fb32abe96975c1acd743da2b9d (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#!/usr/bin/env zsh

###########
# X setup #
###########

source ~/.config/init/vars

#merge Xresources
if [ -s "$HOME/.Xresources" ]
then
	xrdb -override "$HOME/.Xresources"
fi

if [ -s $tmpdir/x-theme ]
then
	xrdb -override $tmpdir/x-theme
fi

#theme
export QT_STYLE_OVERRIDE=adwaita-dark
export GTK_THEME=Adwaita:dark

#input!
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export SDL_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
fcitx5 &

#keyrate
xset r rate $kbdelay $kbrate

#store sxiv cache in ram
export XDG_CACHE_HOME="$HOME/.cache"
mkdir -p "$HOME/.cache"
if [ -d $tmpdir ]; then
    mkdir -p $tmpdir/sxiv
    cd "$HOME/.cache/"
    ln -sf $tmpdir/sxiv .
    cd
fi

#load more fonts
xset +fp /usr/share/fonts/local
xset +fp /usr/share/fonts/misc
xset +fp "$HOME/.fonts"
xset fp rehash

#disable power saving, so screen doesn't power off
xset -dpms
xset s off

#daemons
picom -b --backend glx --vsync --glx-no-stencil --glx-no-rebind-pixmap

xsetroot -cursor_name left_ptr
nitrogen --restore
xbanish &

redshift -b 0.8:0.6 -t 5400K:4400K &


###############
# HSWM BASICS #
###############

# always start frames max (pt. 1)
hc set default_frame_layout 2
hc set_layout max

hc set tree_style '╾│ ├└╼─┐'

hc emit_hook reload


###########
#  THEME  #
###########

hc set frame_border_normal_color $bg_normal
hc set frame_border_active_color $bg_focus
hc set frame_bg_normal_color $bg_normal
hc set frame_bg_active_color $bg_focus
hc set window_border_normal_color $bg_normal
hc set window_border_active_color $bg_focus
hc set frame_border_width 2
hc set frame_border_inner_width 0
hc set window_border_width 2
hc set window_border_inner_width 0
hc set always_show_frame 0
hc set frame_bg_transparent 1
hc set frame_normal_opacity 100
hc set frame_active_opacity 100
hc set frame_transparent_width 0
hc set frame_gap 0
hc set frame_padding 0
hc set smart_frame_surroundings 1
hc set smart_window_surroundings 1


#################
#  KEYBINDINGS  #
#################

# remove all existing keybindings
hc keyunbind --all

# keybindings

hc keybind Mod4-Shift-r reload
hc keybind Mod4-q close_or_remove

# basic movement
# focusing clients
hc keybind Mod4-h focus left
hc keybind Mod4-j focus down
hc keybind Mod4-k focus up
hc keybind Mod4-l focus right

# moving clients
hc keybind Mod4-Shift-h shift left
hc keybind Mod4-Shift-j shift down
hc keybind Mod4-Shift-k shift up
hc keybind Mod4-Shift-l shift right

# cycle through clients
hc keybind Mod4-m cycle -1
hc keybind Mod4-e cycle  1

# split frames
hc keybind Mod4-Shift-space split explode

# resizing frames
resizestep=0.04
hc keybind Mod4-Control-h resize left +$resizestep
hc keybind Mod4-Control-j resize down +$resizestep
hc keybind Mod4-Control-k resize up +$resizestep
hc keybind Mod4-Control-l resize right +$resizestep

# tags
tag_names=( {1..5} )

hc rename default $tag_names[1] || true
for ((i=1; i <= $#tag_names; i++)) do
    hc add $tag_names[$i]
	hc keybind "Mod4-$i" use_index $(($i-1))
	hc keybind "Mod4-Control-$i" move_index $(($i-1))
done

# cycle through tags
hc keybind Mod4-n use_index +1 --skip-visible
hc keybind Mod4-p use_index -1 --skip-visible

# jump to last used tag
hc keybind Mod4-Escape use_previous

# layouting
hc keybind Mod4-t pseudotile toggle
hc keybind Mod4-f fullscreen toggle

# mouse
hc mouseunbind --all
hc mousebind Mod4-Button1 move
hc mousebind Mod4-Button2 zoom
hc mousebind Mod4-Button3 resize

# focus
hc keybind Mod4-BackSpace cycle_monitor
hc keybind Mod4-i         jumpto urgent
hc keybind Mod4-w         jumpto last-minimized

## launchers

#dunst
hc keybind Mod4-minus spawn dunstctl close-all

#pass
hc keybind Mod4-x       spawn ~/.config/herbstluftwm/pass.sh
hc keybind Mod4-Shift-x spawn ~/.config/herbstluftwm/pass.sh -f

#scrot-ing
hc keybind Print               spawn ~/.config/herbstluftwm/maim.sh
hc keybind Shift-Print         spawn ~/.config/herbstluftwm/maim.sh -s
hc keybind Control-Print       spawn ~/.config/herbstluftwm/maim.sh -m clipboard
hc keybind Shift-Control-Print spawn ~/.config/herbstluftwm/maim.sh -s -m clipboard
hc keybind Mod4-Print          spawn ~/.config/herbstluftwm/maim.sh -m send
hc keybind Mod4-Shift-Print    spawn ~/.config/herbstluftwm/maim.sh -s -m send

# ranger
hc keybind Mod4-Shift-Control-Return spawn alacritty -e ranger ~
hc keybind Mod4-Shift-Control-a      spawn alacritty -e ranger ~/audio
hc keybind Mod4-Shift-Control-b      spawn alacritty -e ranger ~/documents/books
hc keybind Mod4-Shift-Control-c      spawn alacritty -e ranger ~/documents/comics
hc keybind Mod4-Shift-Control-d      spawn alacritty -e ranger ~/downloads
hc keybind Mod4-Shift-Control-g      spawn alacritty -e ranger ~/games
hc keybind Mod4-Shift-Control-i      spawn alacritty -e ranger ~/images
hc keybind Mod4-Shift-Control-m      spawn alacritty -e ranger ~/music
hc keybind Mod4-Shift-Control-n      spawn alacritty -e ranger ~/documents/manga
hc keybind Mod4-Shift-Control-p      spawn alacritty -e ranger ~/projects
hc keybind Mod4-Shift-Control-s      spawn alacritty -e ranger ~/desktop
hc keybind Mod4-Shift-Control-r      spawn alacritty -e ranger ~/work
hc keybind Mod4-Shift-Control-t      spawn alacritty -e ranger ~/thcool
hc keybind Mod4-Shift-Control-v      spawn alacritty -e ranger ~/videos
hc keybind Mod4-Shift-Control-w      spawn alacritty -e ranger ~/projects/writing

# grab colour to clipboard
hc keybind Mod4-c spawn ~/.config/herbstluftwm/colourgrab.sh

# spawn
hc keybind Mod4-Return  spawn alacritty
hc keybind Mod4-Shift-f spawn firejail --netfilter=/etc/firejail/nolocal.net firefox
hc keybind Mod4-Shift-g spawn gwaei
hc keybind Mod4-Shift-i spawn gimp
hc keybind Mod4-Shift-m spawn ~/.config/herbstluftwm/kanjidraw.sh
hc keybind Mod4-Shift-n spawn alacritty -t "notes" -e $EDITOR ~/notes
hc keybind Mod4-Shift-o spawn ~/yolo/tor/start-tor-browser
hc keybind Mod4-Shift-p spawn inkscape
hc keybind Mod4-Shift-r spawn krita
hc keybind Mod4-Shift-t spawn transmission-gtk
hc keybind Mod4-Shift-v spawn alacritty -e $EDITOR
hc keybind Mod4-Shift-w spawn alacritty -t "weechat" -e weechat
hc keybind Mod4-Shift-z spawn zhudi

# dmenu
hc keybind Mod4-r spawn dmenu_run -fn "${bfont}:size=${bfont_size}" \
	-p "Run:" -h $bheight \
	-nb $bar_bg -nf $bar_fg \
	-sb $bg_focus -sf $fg_focus
hc keybind Mod4-g spawn ~/.config/herbstluftwm/switcher.sh
# hc keybind Mod4-8 spawn ~/.config/herbstluftwm/calc.sh

hc keybind XF86AudioLowerVolume spawn ~/.config/herbstluftwm/pvol.sh down
hc keybind XF86AudioRaiseVolume spawn ~/.config/herbstluftwm/pvol.sh up
hc keybind XF86AudioMute        spawn ~/.config/herbstluftwm/pvol.sh mute
hc keybind XF86AudioMicMute     spawn ~/.config/herbstluftwm/pvol.sh

# tunes
hc keybind Mod4-Up    spawn ~/.config/herbstluftwm/mpc-status.sh
hc keybind Mod4-Down  spawn mpc toggle
hc keybind Mod4-Right spawn ~/.config/herbstluftwm/mpc-status.sh next
hc keybind Mod4-Left  spawn ~/.config/herbstluftwm/mpc-status.sh prev

## end launchers


###########
#  RULES  #
###########

hc unrule -F
hc rule focus=on floating=off
# unmanage docks, dropdowns, etc
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DROPDOWN_MENU|POPUP_MENU)' manage=off
# set apppropriate things to pseudotile
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on focus=on floating=off
hc rule class~'(VBoxSDL|pinentry|pinentry-qt)' pseudotile=on focus=on floating=off
hc rule class~'(mozc_tool|Wine|explorer.exe|Tor Browser)' pseudotile=on focus=on floating=off
hc rule class~'(PCSX2|mednafen)' pseudotile=on focus=on floating=off
hc rule title~'(Kanji Draw)' pseudotile=on focus=on floating=off


#################
#  TABLET MODE  #
#################

if [[ $tablet_mode != "" ]]; then
	hc rule class~'(onboard|Onboard)' manage=off
	hc keybind XF86AudioLowerVolume spawn onboard -m

	hc keybind Mod4-equal spawn xbacklight +10
	hc keybind Mod4-minus spawn xbacklight -10
	hc keybind XF86AudioRaiseVolume spawn ~/.config/herbstluftwm/backlight.sh

	hc keybind Mod4-bracketright spawn ~/.config/herbstluftwm/pvol.sh up
	hc keybind Mod4-bracketleft  spawn ~/.config/herbstluftwm/pvol.sh down
fi


# unlock, just to be sure
hc unlock


##############
#  CHILDREN  #
##############

# run the panel
panel=~/.config/herbstluftwm/panel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(hc list_monitors | cut -d: -f1); do
    # start it on each monitor
    "$panel" $monitor &
done

# run dunst with theme colours
pkill dunst
dunst &