Overview
Key bindings are declared in thebinds {} section of the config.
Basic Syntax
Each bind is a hotkey followed by one action enclosed in curly brackets:+ signs, followed by an XKB key name in the end.
Valid Modifiers
Ctrl or Control
Control key
Shift
Shift key
Alt
Alt key
Super or Win
Super/Windows key
ISO_Level3_Shift or Mod5
AltGr key on certain layouts
ISO_Level5_Shift
Can be used with an xkb lv5 option like
lv5:caps_switchMod
Special modifier:
Super on TTY, Alt in nested windowMod is a special modifier that is equal to Super when running niri on a TTY, and to Alt when running niri as a nested winit window. This way, you can test niri in a window without causing too many conflicts with the host compositor’s key bindings. You can customize the Mod key in the input section of the config.Finding Key Names
Using wev to find key names
Using wev to find key names
To find an XKB name for a particular key, you may use a program like Here, look at
wev.Open it from a terminal and press the key that you want to detect:sym: Left: this is the key name.Binding shifted keys requires spelling out Shift and the unshifted version of the key, according to your XKB layout.For example, on US QWERTY,
< is on Shift + ,, so to bind it, you spell out Mod+Shift+Comma.Bind Properties
Repeat
Binds will repeat by default (i.e. holding down a bind will make it trigger repeatedly). You can disable that for specific binds:Cooldown
Binds can also have a cooldown, which will rate-limit the bind and prevent it from repeatedly triggering too quickly.This is mostly useful for the scroll bindings.
Allow When Locked
Spawn bindings have a specialallow-when-locked=true property that makes them work even while the session is locked:
Allow Inhibiting
You can make certain binds ignore inhibiting with theallow-inhibiting=false property. They will always be handled by niri and never passed to the window.
Scroll Bindings
You can bind mouse wheel scroll ticks using the following syntax. These binds will change direction based on thenatural-scroll setting.
Mouse Click Bindings
You can bind mouse clicks using the following syntax:Mouse clicks operate on the window that was focused at the time of the click, not the window you’re clicking.
Binding
Mod+MouseLeft or Mod+MouseRight will override the corresponding gesture (moving or resizing the window).Custom Hotkey Overlay Titles
The hotkey overlay (the Important Hotkeys dialog) shows a hardcoded list of binds. You can customize this list using thehotkey-overlay-title property.
Adding Custom Binds
Removing Binds
Pango Markup Support
Pango Markup Support
Custom titles support Pango markup:
Key Actions
Every action that you can bind is also available for programmatic invocation vianiri msg action.
spawn
Run a program.Shell Expansion
Shell Expansion
This also means that you cannot expand environment variables or As a special case, niri will expand
~. If you need this, you can run the command through a shell manually.~ to the home directory only at the beginning of the program name:spawn-sh
Run a command through the shell. The argument is a single string that is passed verbatim tosh.
spawn-sh "some command" is equivalent to spawn "sh" "-c" "some command"—it’s just a less confusing shorthand.Keep in mind that going through the shell incurs a tiny performance penalty compared to directly spawning some binary.quit
Exit niri after showing a confirmation dialog to avoid accidentally triggering it.screenshot, screenshot-screen, screenshot-window
Actions for taking screenshots.screenshot: opens the built-in interactive screenshot UIscreenshot-screen: takes a screenshot of the focused screenscreenshot-window: takes a screenshot of the focused window
Advanced Screenshot Options
Advanced Screenshot Options
toggle-keyboard-shortcuts-inhibit
Applications such as remote-desktop clients and software KVM switches may request that niri stops processing its keyboard shortcuts.toggle-keyboard-shortcuts-inhibit is an escape hatch that toggles the inhibitor.
It’s a good idea to bind this, so a buggy application can’t hold your session hostage.