Blob


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