[rc/{afew,bspwm}] migrate afew and bspwm (and sxhkd) configs
[~bandali/configs] / rc.org
1 #+title: rc.org
2 #+property: header-args :comments link :mkdirp yes :results silent
3
4 * About
5
6 This org file contains the configuration files of pretty much every
7 program I use. The files are tangled (i.e. exported, or derived) from
8 this file using =org-babel=.
9
10 Note: This file is best viewed inside Emacs with org mode.
11
12 * Configs
13
14 This section contains the configuration files (dotfiles) of various
15 programs I use.
16
17 ** [[https://github.com/afewmail/afew][afew]]
18 :PROPERTIES:
19 :header-args+: :tangle ~/.config/afew/config
20 :END:
21
22 #+begin_quote
23 an initial tagging script for notmuch mail
24 #+end_quote
25
26 #+begin_src conf
27 # This is the default filter chain
28 [SpamFilter]
29 #[ClassifyingFilter]
30 [KillThreadsFilter]
31 #[ListMailsFilter]
32 [ArchiveSentMailsFilter]
33 sent_tag = sent
34 [InboxFilter]
35
36 #[Filter.1]
37 #query = 'folder:amin/lists/.haskell-cafe'
38 #tags = +lists;+lists/haskell-cafe
39 #message = lists/haskell-cafe
40
41 #[Filter.2]
42 #query = 'folder:amin/lists/.haskell-weekly'
43 #tags = +lists;+lists/haskell-weekly
44 #message = lists/haskell-weekly
45
46 #[Filter.3]
47 #query = 'folder:amin/lists/.hackernewsletter'
48 #tags = +lists;+lists/hackernewsletter
49 #message = lists/hackernewsletter
50
51
52 #[FolderNameFilter]
53 #folder_blacklist = Inbox
54 #maildir_separator = /.
55 #folder_transforms = Drafts:draft Junk:spam Trash:deleted Sent:sent Archive:archive lists/haskell-cafe:lists/haskell-cafe
56 #+end_src
57
58 ** bspwm
59
60 *** bspwmrc
61 :PROPERTIES:
62 :header-args+: :tangle ~/.config/bspwm/bspwmrc :shebang "#!/bin/sh"
63 :END:
64
65 #+begin_src sh
66 sxhkd &
67 sh ~/.fehbg &
68 xfce4-panel -d &
69 #compton &
70 sleep 0.5 && pasystray --notify=all &
71
72 bspc monitor -d I II III IV V VI VII VIII IX X
73 #bspc monitor eDP-1 -d I II III IV V
74 #bspc monitor HDMI-1 -d VI VII VIII IX X
75
76 #bspc config border_width 2
77 #bspc config window_gap 8
78 bspc config window_gap 0
79
80 bspc config bottom_padding 26
81
82 bspc config split_ratio 0.52
83 bspc config borderless_monocle true
84 bspc config gapless_monocle true
85 bspc config click_to_focus button1
86 bspc config directional_focus_tightness low
87
88 bspc rule -a Firefox desktop='^1' follow=on
89 bspc rule -a Nightly desktop='^1' follow=on
90 bspc rule -a Emacs desktop='^2' state=tiled follow=on
91 #bspc rule -a Chromium desktop='^4' follow=on
92 bspc rule -a URxvt state=floating
93 bspc rule -a URxvt:tiled state=tiled
94 bspc rule -a Connman-gtk state=floating
95 bspc rule -a Xfce4-panel state=floating
96 bspc rule -a TelegramDesktop state=floating
97 bspc rule -a Ec state=floating
98 bspc rule -a Pavucontrol state=floating
99 bspc rule -a Eog state=floating
100 bspc rule -a Seahorse state=floating
101 bspc rule -a mpv state=floating
102 bspc rule -a Evince state=floating
103 bspc rule -a Meld state=floating
104 bspc rule -a Autokey-gtk state=floating
105 bspc rule -a Mousepad state=floating
106 bspc rule -a Wrapper-1.0 state=floating
107 bspc rule -a File-roller state=floating
108 bspc rule -a Gnome-disks state=floating
109 bspc rule -a Termite state=floating
110 bspc rule -a Termite:tiled state=tiled
111 bspc rule -a Thunderbird:Calendar state=floating
112 bspc rule -a Audacity state=floating
113 bspc rule -a Proof state=floating # pvs x-show-proof
114 bspc rule -a Nm-connection-editor state=floating
115 bspc rule -a Wire state=floating
116 bspc rule -a discord state=floating
117 bspc rule -a X2goclient state=floating
118 bspc rule -a SimpleScreenRecorder state=floating
119 bspc rule -a Gimp state=floating
120 bspc rule -a Wrapper-2.0 state=floating
121 bspc rule -a Zathura state=tiled
122 #+end_src
123
124 *** sxhkdrc
125 :PROPERTIES:
126 :header-args+: :tangle ~/.config/sxhkd/sxhkdrc
127 :END:
128
129 #+begin_src conf
130 #
131 # wm independent hotkeys
132 #
133
134 # terminal emulator
135 super + {_,shift} + Return
136 urxvt{_, -name tiled}
137
138 #super + {_,shift} + Return
139 # termite{_, --name=tiled}
140
141 # program launcher
142 super + space
143 rofi -show run -display-run '> ' -display-window ' 🗔 '
144
145 super + alt + space
146 xfce4-popup-whiskermenu
147
148 # window finder
149 super + backslash
150 rofi -show window -display-run '> ' -display-window ' 🗔 '
151
152 # password manager
153 alt + space
154 rofi-pass
155
156 # firefox
157 #super + r
158 # firefox
159
160 # chromium
161 #super + c
162 # chromium -incognito
163
164 # emacs
165 super + e
166 emacs
167
168 # make sxhkd reload its configuration files:
169 super + Escape
170 pkill -USR1 -x sxhkd
171
172 # volume {up,down}
173 XF86Audio{Raise,Lower}Volume
174 pamixer --allow-boost --{in,de}crease 5
175
176 # mute
177 XF86AudioMute
178 pamixer --toggle-mute
179
180 # playback control
181 XF86Audio{Play,Prev,Next}
182 mpc {toggle,prev,next}
183
184 # lock the screen
185 super + shift + q
186 light-locker-command -l
187
188 # Toggle keyboard layout
189 super + F7
190 toggle-layout
191
192 # Toggle Xfce presentation mode
193 XF86LaunchB
194 toggle-presentation-mode
195
196 # monitor brightness
197 XF86MonBrightness{Up,Down}
198 light -{A,U} 5
199
200 super + apostrophe
201 rofi-light
202
203 # keyboard brightness
204 #XF86KbdBrightness{Up,Down}
205 # kbdlight {up,down}
206
207 #
208 # bspwm hotkeys
209 #
210
211 # quit bspwm normally
212 super + alt + Escape
213 bspc quit
214
215 # close and kill
216 super + {w,q}
217 bspc node -{c,k}
218
219 # alternate between the tiled and monocle layout
220 super + m
221 bspc desktop -l next
222
223 # send the newest marked node to the newest preselected node
224 super + y
225 bspc node newest.marked.local -n newest.!automatic.local
226
227 # swap the current node and the biggest node
228 super + g
229 bspc node -s biggest
230
231 #
232 # state/flags
233 #
234
235 # set the window state
236 super + {t,shift + t,s,f}
237 bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
238
239 # set the node flags
240 super + ctrl + {m,x,y,z}
241 bspc node -g {marked,locked,sticky,private}
242
243 #
244 # focus/swap
245 #
246
247 # focus the node in the given direction
248 super + {_,shift + }{h,j,k,l}
249 bspc node -{f,s} {west,south,north,east}
250
251 # focus the node for the given path jump
252 super + {p,b,comma,period}
253 bspc node -f @{parent,brother,first,second}
254
255 # focus the next/previous node in the current desktop
256 super + {_,shift + }c
257 bspc node -f {next,prev}.local
258
259 # focus the next/previous desktop in the current monitor
260 super + bracket{left,right}
261 bspc desktop -f {prev,next}.local
262
263 # send to next/prev desktop
264 super + shift + bracket{left,right}
265 bspc node -d {prev,next} --follow
266
267 # focus the last node/desktop
268 super + {grave,Tab}
269 bspc {node,desktop} -f last
270
271 # focus the older or newer node in the focus history
272 super + {o,i}
273 bspc wm -h off; \
274 bspc node {older,newer} -f; \
275 bspc wm -h on
276
277 # focus or send to the given desktop
278 super + {_,shift + }{1-9,0}
279 bspc {desktop -f,node -d} '^{1-9,10}'
280
281 #
282 # preselect
283 #
284
285 # preselect the direction
286 super + ctrl + {h,j,k,l}
287 bspc node -p {west,south,north,east}
288
289 # preselect the ratio
290 super + ctrl + {1-9}
291 bspc node -o 0.{1-9}
292
293 # cancel the preselection for the focused node
294 super + ctrl + space
295 bspc node -p cancel
296
297 # cancel the preselection for the focused desktop
298 super + ctrl + shift + space
299 bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
300
301 #
302 # move/resize
303 #
304
305 # expand a window by moving one of its side outward
306 super + alt + {h,j,k,l}
307 bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
308
309 # contract a window by moving one of its side inward
310 super + alt + shift + {h,j,k,l}
311 bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
312
313 # move a floating window
314 super + {Left,Down,Up,Right}
315 bspc node -v {-20 0,0 20,0 -20,20 0}
316
317 #alt + bracket{left,right}
318 # xdotool key --clearmodifiers ctrl+Page_{Up,Down}
319 #+end_src
320
321 ** compton
322 :PROPERTIES:
323 :header-args+: :tangle ~/.config/compton.conf
324 :END:
325
326 #+begin_src conf
327 # Shadow
328 shadow = false; # Enabled client-side shadows on windows.
329 no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
330 no-dnd-shadow = true; # Don't draw shadows on DND windows.
331 clear-shadow = true; # Zero the part of the shadow's mask behind the
332 # window. Fix some weirdness with ARGB windows.
333 shadow-radius = 5; # The blur radius for shadows. (default 12)
334 shadow-offset-x = -5; # The left offset for shadows. (default -15)
335 shadow-offset-y = -5; # The top offset for shadows. (default -15)
336 # shadow-opacity = 0.7; # The translucency for shadows. (default .75)
337 # shadow-red = 0.0; # Red color value of shadow. (0.0 - 1.0, defaults to 0)
338 # shadow-green = 0.0; # Green color value of shadow. (0.0 - 1.0, defaults to 0)
339 # shadow-blue = 0.0; # Blue color value of shadow. (0.0 - 1.0, defaults to 0)
340 shadow-exclude = [ "n:e:Notification", "class_g = 'Chromium'", "class_g = 'Dmenu'", "class_g = 'Firefox' && argb" ]; # Exclude conditions for shadows.
341 # shadow-exclude = "n:e:Notification";
342 #shadow-exclude = [ "_GTK_FRAME_EXTENTS@:c" ] # Fix dual shadow on some gtk3 powered applications
343 shadow-ignore-shaped = true; # Avoid drawing shadow on all shaped windows
344 # (see also: --detect-rounded-corners)
345
346 # Opacity
347 menu-opacity = 1.0; # The opacity for menus. (default 1.0)
348 #inactive-opacity = 0.9; # Default opacity of inactive windows. (0.0 - 1.0)
349 # active-opacity = 0.8; # Default opacity for active windows. (0.0 - 1.0)
350 frame-opacity = 1.0; # Opacity of window titlebars and borders. (0.1 - 1.0)
351 # inactive-opacity-override = true; # Let inactive opacity set by 'inactive-opacity' overrides
352 # value of _NET_WM_OPACITY. Bad choice.
353 alpha-step = 0.06; # XRender backend: Step size for alpha pictures. Increasing
354 # it may result in less X resource usage,
355 # Yet fading may look bad.
356 #inactive-dim = 0.5; # Dim inactive windows. (0.0 - 1.0)
357 #inactive-dim-fixed = true; # Do not let dimness adjust based on window opacity.
358 # blur-background = true; # Blur background of transparent windows.
359 # Bad performance with X Render backend.
360 # GLX backend is preferred.
361 # blur-background-frame = true; # Blur background of opaque windows with transparent
362 # frames as well.
363 blur-background-fixed = true; # Do not let blur radius adjust based on window opacity.
364 blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];
365 # Exclude conditions for background blur.
366
367 # Fading
368 fading = false; # Fade windows during opacity changes.
369 fade-delta = 3; # The time between steps in a fade in milliseconds. (default 10).
370 fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
371 fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
372 # no-fading-openclose = true; # Avoid fade windows in/out when opening/closing.
373 fade-exclude = [ ]; # Exclude conditions for fading.
374
375 # Other
376 backend = "glx" # Backend to use: "xrender" or "glx". GLX backend is typically
377 # much faster but depends on a sane driver.
378 mark-wmwin-focused = true; # Try to detect WM windows and mark them as active.
379 mark-ovredir-focused = true; # Mark all non-WM but override-redirect windows active (e.g. menus).
380 use-ewmh-active-win = true; # Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused
381 # instead of using FocusIn/Out events. Usually more reliable but
382 # depends on a EWMH-compliant WM.
383 detect-rounded-corners = false; # Detect rounded corners and treat them as rectangular when --shadow-ignore- shaped is on.
384 detect-client-opacity = true; # Detect _NET_WM_OPACITY on client windows, useful for window
385 # managers not passing _NET_WM_OPACITY of client windows to frame
386 # windows.
387 refresh-rate = 0; # For --sw-opti: Specify refresh rate of the screen. 0 for auto.
388 vsync = "drm"; # "none", "drm", "opengl", "opengl-oml", "opengl-swc", "opengl-mswc"
389 # See man page for more details.
390 dbe = false; # Enable DBE painting mode. Rarely needed.
391 paint-on-overlay = true; # Painting on X Composite overlay window. Recommended.
392 sw-opti = false; # Limit compton to repaint at most once every 1 / refresh_rate.
393 # Incompatible with certain VSync methods.
394 unredir-if-possible = false; # Unredirect all windows if a full-screen opaque window is
395 # detected, to maximize performance for full-screen windows.
396 focus-exclude = [ ]; # A list of conditions of windows that should always be considered
397 # focused.
398 detect-transient = true; # Use WM_TRANSIENT_FOR to group windows, and consider windows in
399 # the same group focused at the same time.
400 detect-client-leader = true; # Use WM_CLIENT_LEADER to group windows.
401 invert-color-include = [ ]; # Conditions for windows to be painted with inverted color.
402
403 # GLX backend # GLX backend fine-tune options. See man page for more info.
404 glx-no-stencil = true; # Recommended.
405 glx-copy-from-front = false; # Useful with --glx-swap-method,
406 # glx-use-copysubbuffermesa = true; # Recommended if it works. Breaks VSync.
407 # glx-no-rebind-pixmap = true; # Recommended if it works.
408 glx-no-rebind-pixmap = true; # Recommended if it works.
409 #glx-swap-method = "4"; # See man page.
410 glx-swap-method = "4"; # See man page.
411
412 # Window type settings
413 wintypes:
414 {
415 tooltip = { fade = true; shadow = false; opacity = 1; focus = true; };
416 menu = { shadow = false; };
417 dropdown_menu = { shadow = false; };
418 popup_menu = { shadow = false; };
419 utility = { shadow = false; };
420 # fade: Fade the particular type of windows.
421 # shadow: Give those windows shadow
422 # opacity: Default opacity for the type of windows.
423 # focus: Whether to always consider windows of this type focused.
424 };
425 #+end_src
426
427 ** Git
428
429 *** gitconfig
430 :PROPERTIES:
431 :header-args+: :tangle ~/.gitconfig
432 :END:
433
434 **** user
435 #+begin_src conf
436 [user]
437 name = Amin Bandali
438 email = amin@aminb.org
439 # signingkey = 4E05246AB0BF7FFB
440 #+end_src
441
442 **** signing
443 #+begin_src conf
444 # [commit]
445 # gpgsign = true
446 # [format]
447 # signoff = true
448 #+end_src
449
450 **** core
451 #+begin_src conf
452 [core]
453 autocrlf = input # CRLF -> LF on commit
454 editor = emacsclient -t
455 excludesfile = ~/.gitignore_global
456 pager = "less"
457 #+end_src
458
459 **** gpg
460 #+begin_src conf
461 [gpg]
462 program = gpg2
463 #+end_src
464
465 **** alias
466 #+begin_src conf
467 [alias]
468 git = !exec git # handle nested git calls, e.g. git git status
469 aliases = config --get-regexp '^alias\\.'
470 a = add
471 s = status
472 sl = status --long
473 c = checkout
474 cb = checkout -b
475 b = branch
476 r = rebase
477 p = pull
478 pr = pull --rebase
479 ps = push
480 psf = push --force
481 #+end_src
482
483 **** color
484 #+begin_src conf
485 [color]
486 ui = auto
487 [color "status"]
488 added = green bold
489 changed = red bold
490 untracked = red bold
491 [color "branch"]
492 current = green bold
493 remote = magenta bold
494 [color "diff"]
495 new = green bold
496 old = red bold
497 #+end_src
498
499 **** status
500 #+begin_src conf
501 [status]
502 # showUntrackedFiles = all
503 short=true
504 branch=true
505 #+end_src
506
507 **** github
508 #+begin_src conf
509 [github]
510 user = aminb
511 #+end_src
512
513 *** gitignore
514 :PROPERTIES:
515 :header-args+: :tangle ~/.gitignore_global
516 :END:
517
518 #+begin_src conf
519 *.orig
520 *.py[co]
521 *.sublime-workspace
522 *~
523 .DS_Store
524 *.elc
525 *-autoloads.el
526 #+end_src
527
528 ** Latexmk
529 :PROPERTIES:
530 :header-args+: :tangle ~/.latexmkrc
531 :END:
532
533 #+begin_src conf
534 $pdf_previewer = "start zathura %O %S";
535 $clean_ext = "aux out";
536
537 # $pdf_update_method = 4;
538 # $pdf_update_command = "zathura %O %S";
539
540 # Synctex allows one to jump to from the PDF in Zathura to the source in Emacs
541 # by Ctrl+click in the PDF.
542 # Tell latexmk to use Zathura as a previewer, and run emacsclient as the Synctex
543 # editor.
544 # $pdf_previewer = 'exec zathura --synctex-forward -x \'emacsclient --no-wait +%{line} %{input}\' %O %S';
545 #+end_src
546
547 * Scripts
548
549 This section contains various useful scripts and the ones used by the
550 programs above. For instance, =toggle-tablet= for switching to and
551 from tablet mode on my X220T, =toggle-presentation-mode= for toggling
552 Xfce's presentation mode which keeps the screen awake, and
553 =rofi-light= a small utility that uses [[https://github.com/DaveDavenport/rofi][Rofi]] to ask and [[https://github.com/haikarainen/light][light]] to set an
554 exact brightness value.
555
556 ** rofi-light
557 :PROPERTIES:
558 :header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/bash"
559 :END:
560
561 #+begin_src sh
562 cur=$(light -G)
563 val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 8)
564 light -S $val
565 #+end_src
566
567 ** toggle-layout
568 :PROPERTIES:
569 :header-args+: :tangle ~/.local/bin/toggle-layout :shebang "#!/bin/bash"
570 :END:
571
572 #+begin_src sh
573 lang="$(setxkbmap -print | grep xkb_symbols | cut -d'+' -f 2)"
574
575 if [ "$lang" = "us" ]; then
576 setxkbmap ir
577 else
578 setxkbmap us
579 # xmodmap $HOME/.Xmodmap
580 fi
581 #+end_src
582
583 ** toggle-presentation-mode
584 :PROPERTIES:
585 :header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/bash"
586 :END:
587
588 #+begin_src sh
589 xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
590 #+end_src