You are not logged in.

#1 2022-11-09 12:40:28

Johnystar
Member
Registered: 2021-08-12
Posts: 9

[SOLVED] Separate Xorg configuration for different keyboards

I have 2 keyboards: an "Emi" keyboard and an "Elly" keyboard. Emi wants the cool angle-modded colemak DHm layout with some extra options, while Elly just wants regular qwerty.

Customised colemak layouts have been installed through the install-dreymar-xmod.sh script in the root of the GitHub DreymaR/BigBagKbdTrixXKB repo (link).

Here's the config at /etc/X11/xorg.conf.d/00-keyboard.conf:

Section "InputClass"
        Identifier "emi-keyboard"
        MatchUSBID "0c45:7698"
        NoMatchUSBID "05ac:024f"
        Option "XkbLayout" "us,cz"
        Option "XkbModel" "pc104angle-z"
        Option "XkbVariant" "cmk_ed_us,cmk_ed_ks"
        Option "XkbOptions" "misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh"
EndSection

Section "InputClass"
        Identifier "elly-keyboard"
        MatchUSBID "05ac:024f"
        NoMatchUSBID "0c45:7698"
        Option "XkbLayout" "us,cz"
        Option "XkbModel" "pc104"
        Option "XkbVariant" ",qwerty"
        Option "XkbOptions" ""
EndSection
The problem
  1. When Elly's keyboard is plugged in at boot, everything works as expected big_smile :

    Applied rules from evdev:
    rules:      evdev
    model:      pc104
    layout:     us
    Trying to build keymap using the following components:
    keycodes:   evdev+aliases(qwerty)
    types:      complete
    compat:     complete
    symbols:    pc+us+inet(evdev)
    geometry:   pc(pc104)

    (output from setxkbmap -v 9)

    qwertyuiop
    asdfghjkl
    zxcvbnm

    (the layout visualised)

  2. When I unplug Elly's keyboard and plug in Emi's keyboard, everything again works as expected big_smile :

    Applied rules from evdev:
    rules:      evdev
    model:      pc104angle-z
    layout:     us,cz
    variant:    cmk_ed_us,cmk_ed_ks
    options:    misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh
    Trying to build keymap using the following components:
    keycodes:   evdev(pc104angle-z)+aliases(qwerty)
    types:      complete
    compat:     complete
    symbols:    pc+us(cmk_ed_us)+cz(cmk_ed_ks):2+inet(evdev)+group(shifts_toggle)+compose(menu)+level5(caps_switch_lock)+extend(basic):1+colemak(cmk_ed_dh):1+extend(basic):2
    geometry:   pc(pc104angle-z)
    qwfpbjluy
    arstgmneio
    xcdvzkh
  3. But then when I replug Elly's keyboard again yikes :

    Applied rules from evdev:
    rules:      evdev
    model:      pc104
    layout:     us,cz
    variant:    ,qwerty
    options:    misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh
    Trying to build keymap using the following components:
    keycodes:   evdev+aliases(qwerty)
    types:      complete
    compat:     complete
    symbols:    pc+us+cz(qwerty):2+inet(evdev)+group(shifts_toggle)+compose(menu)+level5(caps_switch_lock)+extend(basic):1+colemak(cmk_ed_dh):1+extend(basic):2
    geometry:   pc(pc104)
    qwerbyuiop
    asdfgmjkl
    zxcdvnh

    (qwerby instead of qwerty, t is missing entirely, ...)

Additional information

The problem seems to be, that Emi's layout options don't get reset when plugging in Elly's keyboard again. This happens even though

Option "XkbOptions" ""

is set in Elly's section. Weirder still, this can be fixed temporarily for the current X session by simply running:

setxkbmap -model pc104 -layout us -option

Note that the option argument is blank, much like in xorg.conf. The fact that this should work seems to even be confirmed on x.org's documentation page (link) (the way I understand it at least):

Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XkbModel" "pc104"
    Option "XkbLayout" "us"
    Option "XKbOptions" ""
EndSection

... The XkbOptions has been explicitly set to the empty set of parameters. ...

Is there something I'm doing wrong or is this a bug? How can I fix this?

Last edited by Johnystar (2022-11-09 17:30:50)

Offline

#2 2022-11-09 13:38:12

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,269

Re: [SOLVED] Separate Xorg configuration for different keyboards

You could work around it w/ a udev rule that runs "setxkbmap -display :0 -option"

Btw. what happens if you make it a single non-empty option like "compose:caps"?

Offline

#3 2022-11-09 17:30:24

Johnystar
Member
Registered: 2021-08-12
Posts: 9

Re: [SOLVED] Separate Xorg configuration for different keyboards

Thanks for the suggestion, turns out setting it to

Option "XKbOptions" " "

instead of

Option "XKbOptions" ""

did the trick!

Marking as solved :D

Offline

Board footer

Powered by FluxBB