#372·niri

Gesture bindings

Author: YaLTeRCreated May 21, 2024Updated Sep 16, 2026
Labelsneeds designarea:input

Add some way to customize gesture bindings. I don't have a concrete design yet, but:

  1. Users should be able to customize how many fingers to use for the swipe gestures (supersede https://github.com/YaLTeR/niri/pull/315, cc @MagneFire)
  2. I should be able to add new gestures without breaking users' configs
  3. Users should be able to bind gestures only where it makes sense, i.e. swipe actions to swipe gestures and not to pinch gestures for example

I'm thinking something like a binds section, but for gestures. To satisfy 1. and 2., maybe encode number of fingers explicitly into the "key"?

gestures {
    touchpad-swipe-3-horizontal horizontal-view-movement
    touchpad-swipe-3-vertical workspace-switch
    Mod+Mouse3-horizontal horizontal-view-movement
    Mod+touch-swipe-3-horizontal horizontal-view-movement
}

This way, I can add new defaults when this section is missing from the config, and when it is present in the config the user will just need to add new gestures manually.

I don't entirely like this though, looks kinda awkward.

Also, I can see a problem in the future where there may be a 2D gesture, and so you will need to be able to bind either touchpad-swipe-N to a 2D gesture, or separate touchpad-swipe-N-horizontal/vertical to 1D gestures. But also maybe that's not a problem and can just be verified during parsing.

Also, this "gestures" section that I have in mind seems to be mainly about continuous gestures (swipe and pinch) and not about discrete gestures like double-resize-click (these seem more fit for the regular binds section).

Also, should it be allowed to bind "vertical" to "horizontal" gestures and vice versa? Maybe not.