List i3 keyboard shortcuts
It’s gonna get all nerdy in here 👓
Yesterday afternoon I had a spare moment and decided to waste it by scratching a tiny itch ; So I went ahead and wrote a script to parse the i3 config file, extract keysym
bindings infdormation (yes, even those nested into modes) and present it in a useful and timely manner.
i3 CKB Shortcuts
It could be better ; What I’d like is something close to which-key, that displays available key combinations along your typing, that is, when you type $mod+a
to launch an application, it presents you with the list of already bound keys ; But this is just a plain list, presented in the most ergonomic way possible.
So now on my machines, both $mod+Shift+k
and k
in any mode shoots up the window.
Technically, it is a Python3 script that reads and parse ~/.config/i3/config
and, depending on the CLI arguments, outputs them to the console stdout
or as a Pango markup formatted page, that can then in turn be read by a browser, or something like zenity.
Currently, it’s reading my modes because of the specific formatting of my own config file :
1 | # MODE: |
So YMMV. This script will be universal in good time. Think about it really hard, it’s not that easy if you put your exec
s in vars. Yes, I told you it wasn’t trivial.
1 | px-i3-keyboard-shortcuts.py -h |
Normally I’d just feed the page to the default browser, but xdg-open
is currently broken in Firefox snap 😕
Source here.
In i3
1 | set $i3_keyboard_shortcuts "~/.scripts/px-i3-keyboard-shortcuts.py -t html -o file && zenity --text-info --title='i3 Keyboard Shortcuts' --width=640 --height=800 --html --window-icon=info --filename=/tmp/.i3-kb-bindings.html" |
But also in all the modes (that is, press k
when you’re in a mode and forgot the key you wanted to type)
1 | bindsym $mod+z mode "$system_mode" |
That’s it seen you next time have a nice week 🤖