Hot Reload
SamWM can reload its Lua configuration without restarting. This lets you update keybindings, window rules, and layout settings on the fly.
Trigger Reload
Via SIGHUP Signal
Send the SIGHUP signal to the SamWM process:
kill -HUP $(pidof samwm)Via IPC Socket
echo "reload" | socat - UNIX-CONNECT:$XDG_RUNTIME_DIR/samwm.sockOr use the CLI:
samwm-msg reloadWhat Gets Reloaded
| Component | Reloaded? | Notes |
|---|---|---|
| Keybindings | ✅ Yes | Active keybindings updated immediately |
| Window rules | ✅ Yes | Applied to all existing windows |
| Layout config | ✅ Yes | Master factor, gap settings, smart gaps |
| Keyboard repeat | ✅ Yes | Repeat rate and delay updated immediately |
| Startup commands | ❌ No | Requires restart |
| Workspace count | ❌ No | Requires restart |
Using in Scripts
Reload on config file save (requires external tool like inotifywait):
#!/bin/bash
# Watch config and reload on change
inotifywait -e modify ~/.config/samwm/config.lua
kill -HUP $(pidof samwm)With entr:
echo ~/.config/samwm/config.lua | entr -p kill -HUP $(pidof samwm)Debugging Reload
If reload doesn’t work as expected:
- Check for Lua syntax errors in your config
- Verify the config file path is correct
- Check SamWM logs for reload status
- Make sure the signal is reaching the right process
# Find SamWM PID
pidof samwm
# Verify signal delivery
kill -0 $(pidof samwm) && echo "Process exists"
# Watch logs
journalctl -f -u samwmReload via IPC
The IPC socket also emits a reload event after successful config reload, useful for status bars or external tools:
# Subscribe to reload events
echo "subscribe reload" | socat - UNIX-CONNECT:$XDG_RUNTIME_DIR/samwm.sock
# Trigger reload from another terminal
samwm-msg reload
# Output:
# OK subscribed to reload
# {"type":"reload","data":{"status":"reloaded"}}Config File Location
By default, SamWM looks for:
~/.config/samwm/config.lua
$XDG_CONFIG_HOME/samwm/config.luaOverride with the --config flag:
samwm --config /path/to/config.luaHot Reload vs Restart
| Feature | Hot Reload | Restart |
|---|---|---|
| Speed | Instant | Full restart |
| Window positions | Preserved | Preserved |
| Keybindings | Updated | Updated |
| Keyboard repeat | Updated | Applied |
| Workspace changes | Not applied | Applied |