Blame


1 c1e9083b 2022-02-21 op # herbstluftwm
2 c1e9083b 2022-02-21 op
3 c1e9083b 2022-02-21 op herbstluftwm is a window manager. The following is my configuration,
4 c1e9083b 2022-02-21 op which is based on the default one (with tweaks to avoid depending on
5 c1e9083b 2022-02-21 op bash)
6 c1e9083b 2022-02-21 op
7 c1e9083b 2022-02-21 op #!/bin/sh
8 c1e9083b 2022-02-21 op
9 c1e9083b 2022-02-21 op herbstclient is quite long to write, so abbreviate it
10 c1e9083b 2022-02-21 op
11 c1e9083b 2022-02-21 op alias hc=herbstclient
12 c1e9083b 2022-02-21 op
13 c1e9083b 2022-02-21 op hc emit_hook reload
14 c1e9083b 2022-02-21 op
15 c1e9083b 2022-02-21 op remove all existing keybindings before adding the new ones
16 c1e9083b 2022-02-21 op
17 c1e9083b 2022-02-21 op hc keyunbind --all
18 c1e9083b 2022-02-21 op
19 c1e9083b 2022-02-21 op I prefer using mod4 (the super/windows/... key) to manage the window
20 c1e9083b 2022-02-21 op manger, with only few exceptions
21 c1e9083b 2022-02-21 op
22 c1e9083b 2022-02-21 op #Mod=Mod1 # Use alt as the main modifier
23 c1e9083b 2022-02-21 op Mod=Mod4 # Use the super key as the main modifier
24 c1e9083b 2022-02-21 op
25 6abdd427 2022-02-23 op hc keybind $Mod-Tab use_previous
26 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-q quit
27 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-r reload
28 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-c close
29 c1e9083b 2022-02-21 op hc keybind $Mod-slash spawn menu
30 c1e9083b 2022-02-21 op hc keybind $Mod-Control-Return spawn emacsclient -c
31 c1e9083b 2022-02-21 op hc keybind Control-Mod1-Return spawn xterm
32 c1e9083b 2022-02-21 op
33 694e4bd0 2022-02-21 op control amused (my music player)
34 694e4bd0 2022-02-21 op
35 c1e9083b 2022-02-21 op hc keybind XF86AudioNext spawn amused next
36 c1e9083b 2022-02-21 op hc keybind XF86AudioPlay spawn amused toggle
37 da114011 2022-02-23 op hc keybind XF86AudioPrev spawn amused prev
38 da114011 2022-02-23 op hc keybind XF86AudioStop spawn amused stop
39 c1e9083b 2022-02-21 op
40 694e4bd0 2022-02-21 op I don't have a dedicated key for screenshot, but Scroll_Lock is not too
41 694e4bd0 2022-02-21 op awkward to press
42 694e4bd0 2022-02-21 op
43 694e4bd0 2022-02-21 op hc keybind $Mod-Scroll_Lock spawn sshot -c
44 694e4bd0 2022-02-21 op hc keybind $Mod-Shift-Scroll_Lock spawn sshot -cs
45 694e4bd0 2022-02-21 op
46 c1e9083b 2022-02-21 op basic movement in tiling and floating mode focusing clients
47 c1e9083b 2022-02-21 op
48 c1e9083b 2022-02-21 op hc keybind $Mod-Left focus left
49 c1e9083b 2022-02-21 op hc keybind $Mod-Down focus down
50 c1e9083b 2022-02-21 op hc keybind $Mod-Up focus up
51 c1e9083b 2022-02-21 op hc keybind $Mod-Right focus right
52 c1e9083b 2022-02-21 op hc keybind $Mod-h focus left
53 c1e9083b 2022-02-21 op hc keybind $Mod-j focus down
54 c1e9083b 2022-02-21 op hc keybind $Mod-k focus up
55 c1e9083b 2022-02-21 op hc keybind $Mod-l focus right
56 c1e9083b 2022-02-21 op
57 c1e9083b 2022-02-21 op moving clients in tiling and floating mode
58 c1e9083b 2022-02-21 op
59 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-Left shift left
60 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-Down shift down
61 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-Up shift up
62 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-Right shift right
63 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-h shift left
64 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-j shift down
65 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-k shift up
66 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-l shift right
67 c1e9083b 2022-02-21 op
68 c1e9083b 2022-02-21 op splitting frames creates an empty frame at the specified direction
69 c1e9083b 2022-02-21 op
70 c1e9083b 2022-02-21 op hc keybind $Mod-u split bottom 0.5
71 c1e9083b 2022-02-21 op hc keybind $Mod-o split right 0.5
72 c1e9083b 2022-02-21 op
73 c1e9083b 2022-02-21 op let the current frame explode into subframes
74 c1e9083b 2022-02-21 op
75 c1e9083b 2022-02-21 op hc keybind $Mod-Control-space split explode
76 c1e9083b 2022-02-21 op
77 c1e9083b 2022-02-21 op resizing frames and floating clients
78 c1e9083b 2022-02-21 op
79 c1e9083b 2022-02-21 op resizestep=0.02
80 c1e9083b 2022-02-21 op hc keybind $Mod-Control-h resize left +$resizestep
81 c1e9083b 2022-02-21 op hc keybind $Mod-Control-j resize down +$resizestep
82 c1e9083b 2022-02-21 op hc keybind $Mod-Control-k resize up +$resizestep
83 c1e9083b 2022-02-21 op hc keybind $Mod-Control-l resize right +$resizestep
84 c1e9083b 2022-02-21 op hc keybind $Mod-Control-Left resize left +$resizestep
85 c1e9083b 2022-02-21 op hc keybind $Mod-Control-Down resize down +$resizestep
86 c1e9083b 2022-02-21 op hc keybind $Mod-Control-Up resize up +$resizestep
87 c1e9083b 2022-02-21 op hc keybind $Mod-Control-Right resize right +$resizestep
88 c1e9083b 2022-02-21 op
89 c1e9083b 2022-02-21 op add the tags
90 c1e9083b 2022-02-21 op
91 405b6660 2022-02-22 op hc rename default "1" || true
92 c1e9083b 2022-02-21 op addtag() {
93 c1e9083b 2022-02-21 op hc add $1
94 c1e9083b 2022-02-21 op if [ ! -z "$2" ]; then
95 405b6660 2022-02-22 op hc keybind "$Mod-$2" use $1
96 405b6660 2022-02-22 op hc keybind "$Mod-Shift-$2" move $1
97 c1e9083b 2022-02-21 op fi
98 c1e9083b 2022-02-21 op }
99 c1e9083b 2022-02-21 op
100 405b6660 2022-02-22 op addtag 1 ampersand
101 405b6660 2022-02-22 op addtag 2 braceleft
102 405b6660 2022-02-22 op addtag 3 bracketleft
103 405b6660 2022-02-22 op addtag 4 parenleft
104 405b6660 2022-02-22 op addtag 5 equal
105 405b6660 2022-02-22 op addtag 6 plus
106 405b6660 2022-02-22 op addtag 7 parenright
107 405b6660 2022-02-22 op addtag 8 bracketright
108 405b6660 2022-02-22 op addtag 9 braceright
109 405b6660 2022-02-22 op addtag 0 exclam
110 c1e9083b 2022-02-21 op
111 c1e9083b 2022-02-21 op cycle through tags
112 c1e9083b 2022-02-21 op
113 c1e9083b 2022-02-21 op hc keybind $Mod-period use_index +1 --skip-visible
114 c1e9083b 2022-02-21 op hc keybind $Mod-comma use_index -1 --skip-visible
115 c1e9083b 2022-02-21 op
116 c1e9083b 2022-02-21 op manage the layout
117 c1e9083b 2022-02-21 op
118 c1e9083b 2022-02-21 op hc keybind $Mod-r remove
119 c1e9083b 2022-02-21 op hc keybind $Mod-s floating toggle
120 c1e9083b 2022-02-21 op hc keybind $Mod-f fullscreen toggle
121 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
122 c1e9083b 2022-02-21 op hc keybind $Mod-Shift-m set_attr clients.focus.minimized true
123 c1e9083b 2022-02-21 op hc keybind $Mod-Control-m jumpto last-minimized
124 c1e9083b 2022-02-21 op hc keybind $Mod-p pseudotile toggle
125 c1e9083b 2022-02-21 op
126 facb7f01 2022-02-23 op I prefer for the default layout to be `max' (only one window visible)
127 facb7f01 2022-02-23 op
128 facb7f01 2022-02-23 op hc set default_frame_layout max
129 facb7f01 2022-02-23 op
130 c1e9083b 2022-02-21 op The following cycles through the available layouts within a frame, but
131 c1e9083b 2022-02-21 op skips layouts, if the layout change wouldn't affect the actual window
132 c1e9083b 2022-02-21 op positions. I.e. if there are two windows within a frame, the grid
133 c1e9083b 2022-02-21 op layout is skipped.
134 c1e9083b 2022-02-21 op
135 c1e9083b 2022-02-21 op hc keybind $Mod-space \
136 c1e9083b 2022-02-21 op or , and . compare tags.focus.curframe_wcount = 2 \
137 c1e9083b 2022-02-21 op . cycle_layout +1 \
138 c1e9083b 2022-02-21 op vertical horizontal max vertical grid \
139 c1e9083b 2022-02-21 op , cycle_layout +1
140 c1e9083b 2022-02-21 op
141 c1e9083b 2022-02-21 op mouse bindings
142 c1e9083b 2022-02-21 op
143 c1e9083b 2022-02-21 op hc mouseunbind --all
144 405b6660 2022-02-22 op hc mousebind $Mod-Button1 move
145 c1e9083b 2022-02-21 op hc mousebind $Mod-Button2 zoom
146 c1e9083b 2022-02-21 op hc mousebind $Mod-Button3 resize
147 c1e9083b 2022-02-21 op
148 c1e9083b 2022-02-21 op focus
149 c1e9083b 2022-02-21 op hc keybind Mod1-Tab cycle_all +1
150 c1e9083b 2022-02-21 op hc keybind Mod1-Shift-Tab cycle_all -1
151 c1e9083b 2022-02-21 op
152 c1e9083b 2022-02-21 op hc keybind $Mod-BackSpace cycle_monitor
153 c1e9083b 2022-02-21 op hc keybind $Mod-c cycle
154 c1e9083b 2022-02-21 op hc keybind $Mod-i jumpto urgent
155 c1e9083b 2022-02-21 op
156 c1e9083b 2022-02-21 op theme
157 c1e9083b 2022-02-21 op
158 c1e9083b 2022-02-21 op hc attr theme.tiling.reset 1
159 c1e9083b 2022-02-21 op hc attr theme.floating.reset 1
160 c1e9083b 2022-02-21 op hc set frame_border_active_color '#222222cc'
161 c1e9083b 2022-02-21 op hc set frame_border_normal_color '#ffffff'
162 c1e9083b 2022-02-21 op hc set frame_bg_normal_color '#565656aa'
163 c1e9083b 2022-02-21 op hc set frame_bg_active_color '#345F0Caa'
164 c1e9083b 2022-02-21 op hc set frame_border_width 1
165 c1e9083b 2022-02-21 op hc set always_show_frame on
166 c1e9083b 2022-02-21 op hc set frame_bg_transparent on
167 c1e9083b 2022-02-21 op hc set frame_transparent_width 5
168 c1e9083b 2022-02-21 op hc set frame_gap 4
169 c1e9083b 2022-02-21 op
170 c1e9083b 2022-02-21 op hc attr theme.title_height 0
171 c1e9083b 2022-02-21 op #hc attr theme.title_font 'Dejavu Sans:pixelsize=12' # example using Xft
172 c1e9083b 2022-02-21 op hc attr theme.title_font '-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
173 c1e9083b 2022-02-21 op hc attr theme.padding_top 2 # space below the title's baseline (i.e. text depth)
174 c1e9083b 2022-02-21 op hc attr theme.active.color '#9AFAFF'
175 c1e9083b 2022-02-21 op hc attr theme.title_color '#222222'
176 c1e9083b 2022-02-21 op hc attr theme.normal.color '#ffffef'
177 c1e9083b 2022-02-21 op hc attr theme.urgent.color '#7811A1dd'
178 c1e9083b 2022-02-21 op hc attr theme.normal.title_color '#898989'
179 c1e9083b 2022-02-21 op hc attr theme.inner_width 1
180 c1e9083b 2022-02-21 op hc attr theme.inner_color black
181 c1e9083b 2022-02-21 op hc attr theme.border_width 2
182 c1e9083b 2022-02-21 op hc attr theme.floating.border_width 4
183 c1e9083b 2022-02-21 op hc attr theme.floating.outer_width 1
184 c1e9083b 2022-02-21 op hc attr theme.floating.outer_color black
185 c1e9083b 2022-02-21 op hc attr theme.active.inner_color '#789161'
186 c1e9083b 2022-02-21 op hc attr theme.urgent.inner_color '#9A65B0'
187 c1e9083b 2022-02-21 op hc attr theme.normal.inner_color '#606060'
188 c1e9083b 2022-02-21 op # copy inner color to outer_color
189 c1e9083b 2022-02-21 op for state in active urgent normal ; do
190 c1e9083b 2022-02-21 op hc substitute C theme.${state}.inner_color \
191 c1e9083b 2022-02-21 op attr theme.${state}.outer_color C
192 c1e9083b 2022-02-21 op done
193 c1e9083b 2022-02-21 op hc attr theme.active.outer_width 1
194 c1e9083b 2022-02-21 op hc attr theme.background_color '#141414'
195 c1e9083b 2022-02-21 op
196 c1e9083b 2022-02-21 op hc set window_gap 0
197 c1e9083b 2022-02-21 op hc set frame_padding 0
198 c1e9083b 2022-02-21 op hc set smart_window_surroundings off
199 c1e9083b 2022-02-21 op hc set smart_frame_surroundings on
200 c1e9083b 2022-02-21 op hc set mouse_recenter_gap 0
201 c1e9083b 2022-02-21 op
202 c1e9083b 2022-02-21 op hc set focus_follows_mouse 1
203 c1e9083b 2022-02-21 op hc set raise_on_click false
204 c1e9083b 2022-02-21 op hc set snap_gap 5
205 c1e9083b 2022-02-21 op
206 c1e9083b 2022-02-21 op rules
207 c1e9083b 2022-02-21 op
208 c1e9083b 2022-02-21 op hc unrule -F
209 c1e9083b 2022-02-21 op #hc rule class=XTerm tag=3 # move all xterms to tag 3
210 c1e9083b 2022-02-21 op hc rule focus=on # normally focus new clients
211 c1e9083b 2022-02-21 op hc rule floatplacement=smart
212 c1e9083b 2022-02-21 op #hc rule focus=off # normally do not focus new clients
213 c1e9083b 2022-02-21 op # give focus to most common terminals
214 c1e9083b 2022-02-21 op #hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
215 c1e9083b 2022-02-21 op hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
216 c1e9083b 2022-02-21 op hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
217 c1e9083b 2022-02-21 op hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
218 c1e9083b 2022-02-21 op
219 c1e9083b 2022-02-21 op hc set tree_style '╾│ ├└╼─┐'
220 c1e9083b 2022-02-21 op
221 41361a3a 2022-02-23 op A cool thing about herbstluftwm is that I can "dump" the layout and
222 41361a3a 2022-02-23 op later reload it:
223 41361a3a 2022-02-23 op
224 41361a3a 2022-02-23 op load_layout() {
225 41361a3a 2022-02-23 op if [ -f "$2" ]; then
226 41361a3a 2022-02-23 op hc load $1 "$(cat $2)"
227 41361a3a 2022-02-23 op fi
228 41361a3a 2022-02-23 op }
229 41361a3a 2022-02-23 op
230 41361a3a 2022-02-23 op load_layout 2 ~/herbst.ws.2
231 41361a3a 2022-02-23 op load_layout 3 ~/herbst.ws.3
232 41361a3a 2022-02-23 op
233 c1e9083b 2022-02-21 op unlock, just to be sure
234 c1e9083b 2022-02-21 op
235 c1e9083b 2022-02-21 op hc unlock
236 c1e9083b 2022-02-21 op
237 c1e9083b 2022-02-21 op I'd like to have some gaps around my only monitor, herbstluftwm makes it
238 c1e9083b 2022-02-21 op incredibly easy
239 c1e9083b 2022-02-21 op
240 c1e9083b 2022-02-21 op herbstclient set_monitors $((1920-100))x$((1080-100))+50+50
241 c1e9083b 2022-02-21 op # hc detect_monitors
242 c1e9083b 2022-02-21 op
243 405b6660 2022-02-22 op Finally launche the panel on each screen. I rewrote the original
244 405b6660 2022-02-22 op script for the monitor in a mix of rc (the plan9 shell) and awk.
245 c1e9083b 2022-02-21 op
246 405b6660 2022-02-22 op cd ~/.config/herbstluftwm
247 c1e9083b 2022-02-21 op for monitor in $(hc list_monitors | cut -d: -f1) ; do
248 405b6660 2022-02-22 op ./panel "$monitor" &
249 c1e9083b 2022-02-21 op done