How baskerville/sxhkd works
sxhkd is an X daemon that reads shortcut bindings, grabs the corresponding keys or buttons, and runs configured commands when input matches. The documented configuration supports expanded shortcut/command sets and chained shortcuts; sampled code also shows matching state, lock handling, and optional status-FIFO output. The excerpts establish startup, configuration loading, and grabbing, but omit parts of event dispatch, so those runtime links are marked unverified rather than asserted as source-verified calls.
Main entry points: sxhkd.c sxhkd daemon · types.c Chord and chain matching · grab.c Input grabber · parse.c Config and key parser
Components 13
Daemon Runtime
- sxhkd daemon
src/sxhkd.c - X server
- Input grabber
src/grab.c - Status FIFO
src/sxhkd.c
Bindings and Matching
- Binding configuration
- Config and key parser
src/parse.c - Key symbol mapping
src/parse.c - Hotkey registry
src/types.c - Chord and chain matching
src/types.c
Command Execution
- Shell command runner
src/helpers.c - User shell
- Configured commands
Other components
- Desktop user
Connections 14
- Desktop user → X server: presses keys
README.md - X server → sxhkd daemon: delivers events
- Binding configuration → sxhkd daemon: provides bindings
README.md - sxhkd daemon → Config and key parser: loads config
src/sxhkd.c - Config and key parser → Hotkey registry: builds bindings
- sxhkd daemon → Input grabber: grabs bindings
src/sxhkd.c - Input grabber → X server: requests grabs
src/grab.c - sxhkd daemon → Chord and chain matching: matches events
- Chord and chain matching → Hotkey registry: selects binding
src/types.c - Chord and chain matching → Status FIFO: writes progress
src/types.c - sxhkd daemon → Status FIFO: opens FIFO
src/sxhkd.c - sxhkd daemon → Shell command runner: runs command
- Shell command runner → User shell: invokes shell
src/helpers.c - User shell → Configured commands: executes