2021-11-06 09:18:01 +01:00
|
|
|
;; -*- mode: scheme; -*-
|
|
|
|
(define modkey 'mod4)
|
|
|
|
|
|
|
|
(define (reset-top-level-binding)
|
|
|
|
"Reset the keybindings to the top-level ones."
|
|
|
|
(ungrab-all-keys)
|
|
|
|
(remove-all-keys)
|
|
|
|
(first-binding)
|
|
|
|
(grab-all-keys))
|
|
|
|
|
|
|
|
(define (first-binding)
|
|
|
|
"First binding"
|
2023-05-31 17:54:18 +02:00
|
|
|
;; These are dangerous keybindings, they could be very annoying if they're
|
|
|
|
;; accidentally pressed, so using Shift here to make it a little less easy to
|
|
|
|
;; do this is a good idea.
|
|
|
|
(xbindkey `(,modkey q) "shutdown-rofi")
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey shift r) "herbstclient reload")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Usually I close the applications I use through a menu or keybinding inside
|
|
|
|
;; the application, but not all applications offer this. Sometimes need to
|
|
|
|
;; tell the window manager to do so.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey k) "herbstclient close")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Normally I try to have frames set-up the way I like them programmatically,
|
|
|
|
;; not manually, but sometimes I need to do it manually anyway and remove them
|
|
|
|
;; afterwards.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey mod1 k) "herbstclient remove")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Always spawn an instance of kitty.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey Return) "herbstclient spawn kitty")
|
2023-05-31 17:54:18 +02:00
|
|
|
;; Switch to a running instance of URxvt, Hyper, or kitty or start one.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey t) "herbstclient spawn hlwm-run-or-raise \"\\(URxvt\\|Hyper\\|kitty\\)\" kitty")
|
2023-05-31 17:54:18 +02:00
|
|
|
;; Switch to a running instance of Conceror, Firefox, Chromium, Nyxt, or
|
|
|
|
;; qutebrowser or start one.
|
|
|
|
(xbindkey `(,modkey b) "herbstclient spawn hlwm-run-or-raise \"\\(Conkeror\\|[Ff]irefox\\|Chromium\\|Nyxt\\|qutebrowser\\)\" firefox")
|
|
|
|
;; Switch to a running instance of Emacs, or create an Emacs client frame.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey e) "herbstclient spawn hlwm-run-or-raise Emacs emacsclient --create-frame")
|
2023-05-31 17:54:18 +02:00
|
|
|
;; Lock the screen with C-M-l.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey '(control mod1 l) "herbstclient spawn i3lock")
|
2023-05-31 17:54:18 +02:00
|
|
|
;; Swap visible tags
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey x) "herbstclient spawn hlwm-switch-tags")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Since I use the colemak keyboard layout, hjkl doesn't make much sense. I
|
|
|
|
;; use bnpf instead since that is what I'm used to using in Emacs. I try to
|
|
|
|
;; use my run-or-raise script as much as I can, and have the layouts set-up
|
|
|
|
;; correctly already, but sometimes I still need to move around, resize and
|
|
|
|
;; move clients.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey shift b) "herbstclient shift left")
|
|
|
|
(xbindkey `(,modkey shift n) "herbstclient shift down")
|
|
|
|
(xbindkey `(,modkey shift p) "herbstclient shift up")
|
|
|
|
(xbindkey `(,modkey shift f) "herbstclient shift right")
|
|
|
|
(xbindkey `(,modkey control b) "herbstclient resize left +0.05")
|
|
|
|
(xbindkey `(,modkey control n) "herbstclient resize down +0.05")
|
|
|
|
(xbindkey `(,modkey control p) "herbstclient resize up +0.05")
|
|
|
|
(xbindkey `(,modkey control f) "herbstclient resize right +0.05")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; I usually try to have my layouts set-up programmatically, but this isn't
|
|
|
|
;; always possible or practical.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey shift underscore) "herbstclient split bottom 0.5")
|
|
|
|
(xbindkey `(,modkey shift bar) "herbstclient split right 0.5")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Switching tags by number (key) isn't always practical, sometimes switching
|
|
|
|
;; to next/previous tag is easiest.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey period) "herbstclient use_index +1 --skip-visible")
|
|
|
|
(xbindkey `(,modkey comma) "herbstclient use_index -1 --skip-visible")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Games and sometimes other applications don't always like being forced into
|
|
|
|
;; a strangely sized box, floating mode helps.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey shift control f) "herbstclient floating toggle")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Playing games in fullscreen mode can end badly by having the game spread
|
|
|
|
;; across both monitors. Also watching a twitch stream with lots of text is
|
|
|
|
;; best in fullscreen.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey f) "herbstclient cycle_layout 1 vertical max")
|
|
|
|
(xbindkey `(,modkey m) "herbstclient fullscreen toggle")
|
|
|
|
(xbindkey `(,modkey p) "herbstclient pseudotile toggle")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; The following cycles through the available layouts within a frame, but
|
|
|
|
;; skips layouts, if the layout change wouldn't affect the actual window
|
|
|
|
;; positions. I.e. if there are two windows within a frame, the grid layout is
|
|
|
|
;; skipped.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey space) "herbstclient or , and . compare tags.focus.curframe_wcount = 2 . cycle_layout +1 vertical horizontal max vertical grid , cycle_layout +1")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; focus
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey BackSpace) "herbstclient cycle_monitor")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Use u because i is already used by by navigation commands.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey u) "herbstclient jumpto urgent")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
;; Add some media key bindings for MPD.
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey '(XF86AudioPlay) "herbstclient spawn mpc toggle")
|
|
|
|
(xbindkey '(XF86AudioNext) "herbstclient spawn mpc next")
|
|
|
|
(xbindkey '(XF86AudioPrev) "herbstclient spawn mpc prev")
|
2023-05-31 17:54:18 +02:00
|
|
|
|
|
|
|
(xbindkey-function `(,modkey c) move-bindings)
|
|
|
|
(xbindkey-function `(,modkey s) screenshot-bindings)
|
|
|
|
(xbindkey `(,modkey bracketleft) "herbstclient use_index 0")
|
|
|
|
(xbindkey `(,modkey shift bracketleft) "herbstclient use_index 1")
|
|
|
|
(xbindkey `(,modkey shift bracketright) "herbstclient use_index 2")
|
|
|
|
(xbindkey `(,modkey shift "9") "herbstclient use_index 3")
|
|
|
|
(xbindkey `(,modkey equal) "herbstclient use_index 4")
|
|
|
|
(xbindkey `(,modkey shift "8") "herbstclient use_index 5")
|
|
|
|
(xbindkey `(,modkey shift "0") "herbstclient use_index 6")
|
|
|
|
(xbindkey `(,modkey shift equal) "herbstclient use_index 7")
|
|
|
|
(xbindkey `(,modkey bracketright) "herbstclient use_index 8")
|
|
|
|
(xbindkey `(,modkey shift "1") "herbstclient use_index 9")
|
|
|
|
(xbindkey `(,modkey r) "herbstclient spawn rofi -modi drun -show drun -config /home/chelys/.config/rofi/rofi.rasi")
|
2021-11-06 09:18:01 +01:00
|
|
|
(xbindkey `(,modkey w) "herbstclient spawn rofi -show window -window-command \"/home/chelys/usr/bin/hlwm-switch-to-window {window}\" -config /home/chelys/.config/rofi/windows.rasi"))
|
|
|
|
|
|
|
|
(define (move-bindings)
|
|
|
|
"Second bind"
|
|
|
|
(ungrab-all-keys)
|
|
|
|
(remove-all-keys)
|
|
|
|
(xbindkey "1" "herbstclient move_index 0")
|
|
|
|
(xbindkey-function '(release "1") reset-top-level-binding)
|
|
|
|
(xbindkey "2" "herbstclient move_index 1")
|
|
|
|
(xbindkey-function '(release "2") reset-top-level-binding)
|
|
|
|
(xbindkey "3" "herbstclient move_index 2")
|
|
|
|
(xbindkey-function '(release "3") reset-top-level-binding)
|
|
|
|
(xbindkey "4" "herbstclient move_index 3")
|
|
|
|
(xbindkey-function '(release "4") reset-top-level-binding)
|
|
|
|
(xbindkey "5" "herbstclient move_index 4")
|
|
|
|
(xbindkey-function '(release "5") reset-top-level-binding)
|
|
|
|
(xbindkey "6" "herbstclient move_index 5")
|
|
|
|
(xbindkey-function '(release "6") reset-top-level-binding)
|
|
|
|
(xbindkey "7" "herbstclient move_index 6")
|
|
|
|
(xbindkey-function '(release "7") reset-top-level-binding)
|
|
|
|
(xbindkey "8" "herbstclient move_index 7")
|
|
|
|
(xbindkey-function '(release "8") reset-top-level-binding)
|
|
|
|
(xbindkey "9" "herbstclient move_index 8")
|
|
|
|
(xbindkey-function '(release "9") reset-top-level-binding)
|
|
|
|
(xbindkey "0" "herbstclient move_index 9")
|
|
|
|
(xbindkey-function '(release "0") reset-top-level-binding)
|
|
|
|
(xbindkey-function '(control g) reset-top-level-binding)
|
|
|
|
(xbindkey-function '(Return) reset-top-level-binding)
|
|
|
|
(xbindkey-function '(Escape) reset-top-level-binding)
|
|
|
|
(grab-all-keys))
|
|
|
|
|
|
|
|
(define (screenshot-bindings)
|
|
|
|
"Bindings for taking screenshots"
|
|
|
|
(ungrab-all-keys)
|
|
|
|
(remove-all-keys)
|
|
|
|
(xbindkey "f" "flameshot full ~/pictures/screenshots/")
|
|
|
|
(xbindkey-function '(release f) reset-top-level-binding)
|
|
|
|
(xbindkey "c" "flameshot gui")
|
|
|
|
(xbindkey-function '(release c) reset-top-level-binding)
|
|
|
|
(xbindkey-function '(control g) reset-top-level-binding)
|
|
|
|
(xbindkey-function '(Return) reset-top-level-binding)
|
|
|
|
(xbindkey-function '(Escape) reset-top-level-binding)
|
|
|
|
(grab-all-keys))
|
|
|
|
|
|
|
|
(first-binding)
|