The working tree had replaced the operating contract in AGENTS.md with a niri config-reload + keybinding-constraints note. Content relocated to its proper home: tips.md 3-config-reload (SIGHUP footgun, load-config-file) and key-bindings-syntax.md constraints section. AGENTS.md restored from HEAD.
49 lines
1.6 KiB
Markdown
49 lines
1.6 KiB
Markdown
---
|
|
type: howto
|
|
title: Niri Tips and Gotchas
|
|
description: Practical tips for working with niri — Mod key behavior, shell expansion, config reload, vim keys, and programmatic invocation.
|
|
tags:
|
|
- niri
|
|
- tips
|
|
- gotchas
|
|
verified: 2026-08-28
|
|
---
|
|
|
|
# Helpful Tips
|
|
|
|
## 1. Mod key
|
|
|
|
Use `Mod` instead of `Super` for configs that work both on TTY and in nested windows.
|
|
|
|
## 2. No shell expansion in spawn
|
|
|
|
`spawn` does not expand `$VAR` or `~`. Use `spawn-sh` or wrap in `sh -c`.
|
|
|
|
## 3. Config reload
|
|
|
|
**Do NOT send `SIGHUP` to the niri process** (`kill -s SIGHUP $(pgrep -f 'niri --session')`) — it causes a full session logout/restart instead of a live config reload.
|
|
|
|
Correct reload options, in order of preference:
|
|
- `niri msg action load-config-file` — live reload without disrupting the session (preferred).
|
|
- Log out and back in (safe, guaranteed clean reload).
|
|
- Let the user decide when to reload; agents should modify config files without auto-reloading.
|
|
|
|
Niri reads `~/.config/niri/config.kdl` (or `config.kdl` relative to its CWD). Split config lives in `~/.config/niri/cfg/` — each `.kdl` file is `include`d from the main config, so a reload picks up edits to any included module.
|
|
|
|
## 4. Alternative navigation
|
|
|
|
Vim-like keys (H/J/K/L) are bound by default alongside arrow keys.
|
|
|
|
## 5. Programmatic invocation
|
|
|
|
Every action can be invoked via `niri msg action <action-name>`.
|
|
|
|
## 6. Find XKB keys
|
|
|
|
Use `wev` to discover key names.
|
|
|
|
## Related
|
|
|
|
* [Key Bindings Syntax](/tools/niri/key-bindings-syntax.md) — Configuration details
|
|
* [Action Reference](/tools/niri/action-reference.md) — All available actions
|