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 | New windows use updated rules |
| Layout config | ✅ Yes | Master factor, gap settings |
| Startup commands | ❌ No | Requires restart |
| Input settings | ❌ 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)Lua Reload Hook
-- Run custom code on reload
samwm.on("reload", function()
print("Config reloaded!")
-- Re-apply any runtime changes
end)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 samwmPartial Reload
You can reload specific parts without full reload:
-- Reload only keybindings
samwm.reload("keybindings")
-- Reload only window rules
samwm.reload("windowrules")
-- Reload only layout config
samwm.reload("layout")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 |
| New plugins | Loaded | Loaded |
| Input changes | Not applied | Applied |
| Workspace changes | Not applied | Applied |