A shell script to parse and display keybindings + descriptions, as well as optionally edit them.
- grep
- sed
- rofi
- sxhkdrc setup in the proper format (more info below)
In order to parse properly, you need to place some stuff into your rc file.
You need to place a one line comment directly above a keybinding with this format: description: DESCRIPTION
.
For example:
# description: transparent uxterm
alt + Return
uxterm & sleep 0.25 && transset -a 0.8
Note: It shouldn't matter how you capitalize "description" as I have grep
and sed
set to use case insensitive searching.
However, it has not been tested, so I have no idea how well it works.
And here is what a more full example would look like:
You can also display descriptions without "description: " included:
Note: Your rofi will look different due to using a different theme.
If you like the one I'm using, you may find it here in my dotfiles repo.
curl -sSL https://raw.githubusercontent.com/Phate6660/sxhkd-bindings/master/sxhkd-bindings -o sxkhkd-bindings
- Inspect the script. Don't run scripts from the internet without checking them.
chmod +x sxhkd-keybindings
- Move the script to anywhere in your
$PATH
and run the command, or just run it as is.
$ sxhkd-bindings h
sxhkd-bindings 0.0.1
Phate6660 <https://github.com/Phate6660>
ARGs
----
d: Display descriptions without "description: "
e: Edit "$HOME/.config/sxhkd/sxhkdrc" with "$EDITOR"
h: Display this help message
Anything not the above args, or nothing at all: Display keybindings and descriptions like normal
Note: $HOME
and $EDITOR
actually expand, ain't that neato?
So for me, the e
line actually looks like this:
e: Edit "/home/valley/.config/sxhkd/sxhkdrc" with "/usr/bin/emacs -nw"