A next-generation hotkey daemon for Wayland/X11 written in Rust.
Simple Wayland HotKey Daemon
swhkd
is a display protocol-independent hotkey daemon made in
Rust. swhkd
uses an easy-to-use configuration
system inspired by sxhkd
, so you can easily add or remove hotkeys.
It also attempts to be a drop-in replacement for sxhkd
, meaning your sxhkd
config file is also compatible with swhkd
.
Because swhkd
can be used anywhere, the same swhkd
config can be used across
Xorg or Wayland desktops, and you can even use swhkd
in a TTY.
Installation and building instructions can be found here.
swhks &
swhkd
After opening swhkd
, you can control the program through signals:
sudo pkill -USR1 swhkd
— Pause key checkingsudo pkill -USR2 swhkd
— Resume key checkingsudo pkill -HUP swhkd
— Reload config file
swhkd
closely follows sxhkd
syntax, so most existing sxhkd
configs should
be functional with swhkd
.
The default configuration file is in ~/.config/swhkd/swhkdrc
with a fallback to etc/swhkd/swhkdrc
.
If you use Vim, you can get swhkd
config syntax highlighting with the
swhkd-vim plugin. Install it in
vim-plug with Plug 'waycrate/swhkd-vim'
.
All supported key and modifier names are listed in man 5 swhkd-keys
.
- Add the commands from the "Running" section to your window managers configuration file.
- Enable the service file for your respective init system. Currently, only systemd and OpenRC service files exist and more will be added soon including Runit.
We use a server-client model to keep you safe. The daemon (swhkd
— privileged
process) is responsible for listening to key events and running shell commands.
The server (swhks
— non-privileged process) is responsible for keeping a track of the
environment variables and sending them to the daemon. The daemon
uses these environment variables while running the shell commands.
The daemon only runs shell commands that have been parsed from the config file and there is no way to
run arbitrary shell commands. The server is responsible for only sending the environment variables to the daemon and nothing else.
This seperation of responsibilities ensures security.
So yes, you're safe!