[xbindkeys] Add configuration

This commit is contained in:
Tom Willemse 2021-11-06 01:18:01 -07:00
parent 7c7c01ea76
commit 8ce94b444b
2 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,8 @@
[Unit]
Description=xbindkeys Keybindings
[Service]
ExecStart=xbindkeys -n
[Install]
WantedBy=wm.target

102
xbindkeys/.xbindkeysrc.scm Normal file
View file

@ -0,0 +1,102 @@
;; -*- 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"
(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 shift q) "herbstclient quit")
(xbindkey `(,modkey shift r) "herbstclient reload")
(xbindkey `(,modkey k) "herbstclient close")
(xbindkey `(,modkey mod1 k) "herbstclient remove")
(xbindkey `(,modkey Return) "herbstclient spawn kitty")
(xbindkey `(,modkey t) "herbstclient spawn hlwm-run-or-raise \"\\(URxvt\\|Hyper\\|kitty\\)\" kitty")
(xbindkey `(,modkey b) "herbstclient spawn hlwm-run-or-raise \"\\(Conkeror\\|[Ff]irefox\\|Chromium\\|Next\\|qutebrowser\\)\" firefox")
(xbindkey `(,modkey e) "herbstclient spawn hlwm-run-or-raise Emacs emacsclient --create-frame")
(xbindkey '(control mod1 l) "herbstclient spawn i3lock")
(xbindkey `(,modkey x) "herbstclient spawn hlwm-switch-tags")
(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")
(xbindkey `(,modkey shift underscore) "herbstclient split bottom 0.5")
(xbindkey `(,modkey shift bar) "herbstclient split right 0.5")
(xbindkey `(,modkey period) "herbstclient use_index +1 --skip-visible")
(xbindkey `(,modkey comma) "herbstclient use_index -1 --skip-visible")
(xbindkey `(,modkey shift control f) "herbstclient floating toggle")
(xbindkey `(,modkey f) "herbstclient cycle_layout 1 vertical max")
(xbindkey `(,modkey m) "herbstclient fullscreen toggle")
(xbindkey `(,modkey p) "herbstclient pseudotile toggle")
(xbindkey `(,modkey space) "herbstclient or , and . compare tags.focus.curframe_wcount = 2 . cycle_layout +1 vertical horizontal max vertical grid , cycle_layout +1")
(xbindkey `(,modkey BackSpace) "herbstclient cycle_monitor")
(xbindkey `(,modkey u) "herbstclient jumpto urgent")
(xbindkey '(XF86AudioPlay) "herbstclient spawn mpc toggle")
(xbindkey '(XF86AudioNext) "herbstclient spawn mpc next")
(xbindkey '(XF86AudioPrev) "herbstclient spawn mpc prev")
(xbindkey `(,modkey r) "herbstclient spawn rofi -show run")
(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)