Using Simple X Hotkey Daemon with i3
One thing about i3 which I like is that it gives you all the programs required to get working right away, which are primarily
- The window manager
- A status bar
- A hotkey manager
The default status bar is good enough, but if you want, you can switch i3bar with another bar, such as Polybar, just by editing the i3 config file.
But, it's not the case with the hotkey manager. It's coupled closely with the i3 window manager, and I don't think it can be closed/terminated.
However, it doesn't mean you can't use a different hotkey manager.
This is where Simple X Hotkey Daemon, or sxhkd
comes into the picture, which is a standalone hotkey daemon.
The parser of sxhkd is more powerful than i3's parser, thus you can perform some complicated keybinds. Being standalone, you can use this with other window managers as well.
How to switch to sxhkd?
I would suggest you read through the sxhkd manual and project page first. But the basic structure of a keybind looks like this
key combination
command
That is, you start a line with a desired key combination, and in the next line you write the command, starting with a whitespace.
For adapting your i3 commands, all your keybinds need to be appended by i3-msg
For example, in i3, you have a command to kill the current window.
It's usually like this
bindsym $mod+shift+q kill
In sxhkd, it should be written as follows
super + shift + q
i3-msg kill
Now you can start porting all your commands from the i3 config to the sxhkd config.
To take things slow, I'll suggest to port commands in groups, that is, first you port the movement keys, check out whether it's working, and then port the window adjustment keys. Porting it this way makes debugging easier.
Things to keep in mind
For i3 to properly work, you still need to keep a minimum viable i3 config file, which is this
# i3 config file (v4)
Without this, i3 will not work and throw an error. This behaviour is documented here.
Also, sxhkd is case sensitive, unlike i3. Shift is not a valid key, while shift is.
Conclusion
That's it. Once you port all your commands, it should work just like before but with the added benefit of a decoupled window manager and hotkey daemon.