YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
3.89k stars 117 forks source link

Specific input device configuration #371

Open YaLTeR opened 5 months ago

YaLTeR commented 5 months ago

Ability to configure specific input devices.

Syntax: something along

input {
    mouse "identifier" {
        // Settings for this device.
    }
}

Resolution for a given device:

  1. Search for settings block matching this device's identifier.
  2. If not found, use the general block for this device's type.

Identifier: check what other compositors use, guess it's something libinput should be exposing.

For keyboards, it should support per-keyboard XKB config.

FreeFull commented 5 months ago

This should include the ability to disable the device, too

rustysec commented 5 months ago

I was looking through the current implementation and at the smithay code, and I don't see how to accomplish this at the moment. 100% possible I'm just missing something obvious, still trying to get to know the code base.

YaLTeR commented 5 months ago

Are you referring to something in particular? For libinput settings, it should be possible to simply get the device name and find the right config section in apply_libinput_settings().

For dynamic XKB, you need to look in on_keyboard(), extract the libinput device like this (pretty cursed, but possible), then switch the XKB settings similar to how config hot-reload works I guess?

nebulosa2007 commented 5 months ago

This should include the ability to disable the device, too

I'm expand the request: it should be permanent/toggle (via config file) or eventually (via niri msg action ...).

Use cases are: hotkeys to on/off touchpad, temporary off touchpad while mouse is connected.

YaLTeR commented 5 months ago

This can work similarly to niri msg output: apply a config change transiently until the input section is modified in the real config.

rustysec commented 5 months ago

@YaLTeR Aha, that was the "obvious" hint I was missing. My cursory look through the config and input code just missed this. Thanks!