- Read
sxhkd
status and display the label of hotkey chain
sxhkd-statusd
- Get from here
socat
(tested on version 1.7.3.4)bash
(tested on GNU bash version 5.0.7)- Need to support the associative array feature (at least
bash
version 4)
- Need to support the associative array feature (at least
-
Download the script and put it in path you want.
-
Make the named pipe to write sxhkd status
$ mkfifo /run/user/$UID/sxhkd.fifo
-
Run
sxhkd
with the status pipe.$ sxhkd -s /run/user/$UID/sxhkd.fifo &
-
Run
sxhkd-statusd
with the sxhkd status pipe$ sxhkd-statusd /run/user/$UID/sxhkd.fifo &
-
Open the script, and modify
ADDRESS
in the configuration section to the socket path.- The socket path is the same as sxhkd status pipe, with suffix
.sxhkd-statusd
. declare -r ADDRESS="/run/user/$UID/sxhkd.fifo.sxhkd-statusd"
- The socket path is the same as sxhkd status pipe, with suffix
-
Edit the other configuration in the script for your customization.
-
Add this module in your polybar config, and reload polybar.
[module/sxhkd]
type = custom/script
tail = true
label = %output%
exec = /path/of/the/script.sh
- Configuration is stored directly in the script
- The full path of sxhkd-statusd socket.
- The path is the same as sxhkd status pipe, with suffix
.sxhkd-statusd
. declare -r ADDRESS="/run/user/$UID/sxhkd.fifo.sxhkd-statusd"
- The path is the same as sxhkd status pipe, with suffix
- When you have started hotkey chain, the script will display the label.
- Prefix and suffix of the label. it is useful for formatting the label.
- Assigned label list for each hotkey, as the
["key"]="value"
format
H
+ the prefix of hotkey chain to display, including all whitespace.- single prefix example:
'Hsuper + m'
can be used forsuper + m;
in sxhkdrc
- chained prefix example:
'Hsuper + m; n; o'
forsuper + m; n; o;
- branched chain example:
'Hsuper + m; n; o'
can be used also, whensuper + {m,M}; {n,N}; {o,O};
is written in sxhkdrc.
- all whitespaces are not trimmed, including the last whitespaces.
- When the hotkey is written as
super + m ;
in sxhkdrc,'super + m'
may not be recognized. - Because, there is one whitespace between
m
and;
in sxhkdrc. key in LABEL_TABLE should be'super + m '
- When the hotkey is written as
- The label for the hotkey. it will be displayed actually.
- The actual script is written in this. if you are familiar with bash, you can edit it yourself.
- This script is under the MIT license.