# sxhkd

[sxhkd](https://github.com/baskerville/sxhkd) -- simple X hotkey daemon

sxhkd is set up to manage most of the key bindings in this dotfile configuraition. It is primarily used for three things: system control, to invoke rofi, and to switch between different desktop operating modes.

## system control

* super+x: lock the system, i.e. put a lockscreen in front of it, unlocked with your password
* media keys: control the Brightness, Volume, Mute of the system
* super+return: open a terminal

## rofi invocations

* super+backspace: system management (shutdown,reboot,logout,..)
* super+space: app launching
* super+r: extended run menu
* super+p: password/secret autofill menu
* super+F8: theme setting menu
* super+q: quick access to bookmarks and search bangs

## modal desktop

The modal setup of this desktop allows to first invoke an operating mode and then open the possibility for additional keybindings.
For example, `alt + m` will invoke the `media` mode and then media playback can be controlled through the hjkl keys.
Think of it like invoking the insert mode, or visual mode in a modal editor like vim.

The idea behind the modal system is to not overload normal system operation with key binds that are only needed every now and again, and mostly as a coherent package.
If I want to control my media playback, by seeking forward or backward, having quick access to controlling the volume seems logical.
But I may not want to open a scholarly pdf, or programming project at the same time, so these actions don't need to be included in a coherent 'media' mode.

The modes currently are:

* media, for controlling playback and volume
* academia, for opening pdf, seeing upcoming readings, and editing references

They are still in flux and may change every now and again as I put this modal setup to the test. To get a closer look at the actual key binds, look into `.config/sxhkd/sxhkdrc` for now.

## modal notifications

To know which mode is currently active on the desktop, this module includes a script which will print sxhkd's current mode to stdout, or a file.
This script can be used to show the active mode in a status bar, for example (as the polybar module in these dotfiles does).

The script lives in `.local/bin/sxhkd-chain-labels` and can be invoked from the path by default. To see available options and the configuration file format use `sxhkd-chain-labels -h`, or take look at the script itself.

This module overwrites the usual sxhkd program invocation using an alias, which makes sxhkd always (if no options are passed) create and use a named pipe in the XDG_RUNTIME_DIR directory. This is the default location the script will pick it up in.
