YaLTeR / niri

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

per keyboard device config #417

Open rustysec opened 1 month ago

rustysec commented 1 month ago

this PR allows keyboards to be configured by name. the following config sets my laptop's built in keyboard layout to colemak while allowing my external keyboard (already flashed with colemak) to work as expected.

input {
    keyboard "AT Translated Set 2 keyboard" {
        xkb {
            layout "us(colemak),us"
            options "caps:escape_shifted_capslock,lv3:menu_switch,lv3:ralt_alt"
        }
    }

    keyboard {
        xkb {
            // layout "us(colemak),us"
            // options "caps:escape_shifted_capslock,lv3:menu_switch,lv3:ralt_alt"
        }
    }
}

the last used configuration is cached between calls to on_keyboard() in an attempt to squeeze some performance gains. based on the feedback on this implementation, the same can be quickly done for all other supported input types.

rustysec commented 1 month ago

whoops! fixing the errors.