Skip to main content

Overview

In this section you can configure input devices like keyboard and mouse, and some input-related options. There’s a section for each device type: keyboard, touchpad, mouse, trackpoint, trackball, tablet, touch. Settings in those sections will apply to every device of that type.
Currently, there’s no way to configure specific devices individually (but that is planned).

Keyboard

Layout

In the xkb section, you can set layout, variant, options, model and rules. These are passed directly to libxkbcommon, which is also used by most other Wayland compositors.
See the xkeyboard-config(7) manual for more information on XKB options.
Alternatively, you can directly set a path to a .xkb file containing an xkb keymap. This overrides all other xkb settings.
If the xkb section is empty (like it is by default), niri will fetch xkb settings from systemd-localed at org.freedesktop.locale1 over D-Bus.You can see this layout in localectl and change it with localectl set-x11-keymap:
These settings are picked up by some other programs too, like GDM.

Layout Tracking

When using multiple layouts, niri can remember the current layout globally (the default) or per-window.
string
default:"global"
Controls how keyboard layouts are tracked:
  • global: layout change is global for all windows
  • window: layout is tracked for each window individually

Repeat Settings

number
default:"600"
Delay in milliseconds before the keyboard repeat starts
number
default:"25"
Rate in characters per second

Num Lock

Set the numlock flag to turn on Num Lock automatically at startup.
You might want to disable (comment out) numlock if you’re using a laptop with a keyboard that overlays Num Lock keys on top of regular keys.

Pointing Devices

Most settings for the pointing devices are passed directly to libinput. Other Wayland compositors also use libinput, so it’s likely you will find the same settings there.
For flags like tap, omit them or comment them out to disable the setting.

Common Settings

A few settings are common between touchpad, mouse, trackpoint, and trackball:
flag
If set, inverts the scrolling direction
number
default:"0.0"
Pointer acceleration speed. Valid values are from -1.0 to 1.0
string
default:"adaptive"
Can be adaptive (the default) or flat (disables pointer acceleration)
string
When to generate scroll events instead of pointer motion events. Can be:
  • no-scroll
  • two-finger
  • edge
  • on-button-down
The default and supported methods vary depending on the device type.
flag
If set, changes the device to left-handed mode
flag
Emulate a middle mouse click by pressing left and right mouse buttons at once

Touchpad Settings

flag
Enable tap-to-click
flag
Disable-when-typing
flag
Disable-when-trackpointing
boolean
Controls if tap-and-drag is enabled
flag
If set, lifting the finger off for a short time while dragging will not drop the dragged item.
string
Can be left-right-middle or left-middle-right. Controls which button corresponds to a two-finger tap and a three-finger tap.
string
Can be button-areas or clickfinger. Changes the click method.
flag
Do not send events while external pointer device is plugged in
number
Scales the scrolling speed by this value You can also override horizontal and vertical scroll factor separately:

Mouse Settings

Mouse supports the same common settings as touchpad, plus scroll-factor.

Tablet and Touch Settings

Tablets and touchscreens are absolute pointing devices that can be mapped to a specific output:
string
Map the device to a specific output. Valid output names are the same as the ones used for output configuration.
float[6]
Set to six floating point numbers to change the calibration matrix.
  • for tablet
  • for touch
When a tablet is not mapped to any output, it will map to the union of all connected outputs, without aspect ratio correction.

General Settings

Disable Power Key Handling

By default, niri will take over the power button to make it sleep instead of power off. Set this if you would like to configure the power button elsewhere (i.e. logind.conf).

Warp Mouse to Focus

Makes the mouse warp to newly focused windows. Does not make the cursor visible if it had been hidden.
You can customize the warp behavior with the mode property:
string
default:"default"
  • default: warps separately horizontally and vertically
  • center-xy: warps by both X and Y coordinates together
  • center-xy-always: always warps to center, even if mouse was already inside the window

Focus Follows Mouse

Focuses windows and outputs automatically when moving the mouse over them.
You can optionally set max-scroll-amount. Then, focus-follows-mouse won’t focus a window if it will result in the view scrolling more than the set amount. The value is a percentage of the working area width.

Workspace Auto Back and Forth

Normally, switching to the same workspace by index twice will do nothing (since you’re already on that workspace). If this flag is enabled, switching to the same workspace by index twice will switch back to the previous workspace.
Niri will correctly switch to the workspace you came from, even if workspaces were reordered in the meantime.

Modifier Keys

Customize the Mod key for key bindings. Only valid modifiers are allowed, e.g. Super, Alt, Mod3, Mod5, Ctrl, Shift.
string
default:"Super"
The modifier key to use for bindings when running niri on a TTY (default: Super)
string
default:"Alt"
The modifier key to use for bindings when running niri as a nested window (default: Alt)
There are a lot of default bindings with Mod, none of them “make it through” to the underlying window. You probably don’t want to set mod-key to Ctrl or Shift, since Ctrl is commonly used for app hotkeys, and Shift is used for regular typing.