Bug 384702 - KWin doesn't expose a way to use one keymap per keyboard
Summary: KWin doesn't expose a way to use one keymap per keyboard
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.8.7
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-14 11:52 UTC by Pierre Ducroquet
Modified: 2024-04-21 17:24 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
mgraesslin: Wayland+
mgraesslin: X11-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Ducroquet 2017-09-14 11:52:39 UTC
Hi

With Wayland, the responsibilities of the Window Manager are much greater than under X11. I have got a quite special use case that has never been covered in KWin or the keyboard KCM before, but with Wayland I can not use xinput/setxkbmap anymore to work around it.
My main keyboard is a TypeMatrix 2030 with a Bépo layout (a french dvorak-like keymap). That keymap doesn't share anything with the classical qwerty/qwertz/azerty keymaps. When I use a yubikey to generate one time token, I have to set the keymap of the yubikey only to a qwerty layout for it to generate proper tokens. I also have a «classical» keyboard attached to the computer when guests come and want to use the computer.
Right now, KWin and its input configuration system can not handle that usecase. I must switch the keymap when I want to use the guest keyboard, that is ok, but switching keymap every time I want to generate a token is a serious burden.

Could that feature be implemented with a configuration system like the one used in Xorg ? For instance :

Section "InputClass"
        Identifier "typematrix-keyboard"
        MatchIsKeyboard "on"
        MatchVendor "TypeMatrix"
        Option "XkbLayout" "fr"
        Option "XkbVariant" "bepo"
EndSection


Thanks
Comment 1 Martin Flöser 2017-09-14 15:18:53 UTC
I wasn't aware that such a feature in X existed. It sounds interesting. I don't have a real idea yet how to implement it, but it's certainly something which could be done.

Basically all that's needed is to switch the layout to the one specified whenever the keyboard is used. The problem is how to do this specifying. Personally I would prefer if that would be a hint through udev.
Comment 2 Pierre Ducroquet 2017-09-14 15:21:47 UTC
An udev rule would work, I just thought it would be nice to be able to configure that using the GUI only…

FYI, under X11, I configure it manually with xinput/setxkbmap that way :

~$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=16   [slave  pointer  (2)]
⎜   ↳ Kensington      Kensington Expert Mouse   id=9    [slave  pointer  (2)]
⎜   ↳ TypeMatrix.com USB Keyboard               id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera                         id=13   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=17   [slave  keyboard (3)]
    ↳ Yubico Yubikey 4 OTP+U2F+CCID             id=18   [slave  keyboard (3)]
    ↳ TypeMatrix.com USB Keyboard               id=11   [slave  keyboard (3)]
    ↳ TypeMatrix.com USB Keyboard               id=12   [slave  keyboard (3)]
~$ setxkbmap -device 11 fr bepo
Comment 3 aeris 2023-11-27 00:06:54 UTC
Hello,

I bump this bug after 5 years, because I'm hitting it on KDE 5 Wayland.

Same here, I'm using FR-BEPO layout for my main keyboard (Moonlander), but have a secondary Typematrix keyboard and I need to use US for Yubikey (physically hardcoded to send US keycode).
So my X11 config is:

```
Section "InputClass"
  Identifier           "default"
  MatchIsKeyboard      "yes"
  Option "XkbModel"    "pc105"
  Option "XkbLayout"   "fr"
  Option "XkbVariant"  "bepo"
  Option "XkbOptions"  "kpdl:kposs,grp:sclk_toggle,compose:lwin"
EndSection

Section "InputClass"
   Identifier          "typematrix"
   MatchIsKeyboard     "yes"
   MatchVendor         "TypeMatrix.com"
   Option "XkbModel"   "tm2030USB-102"
   Option "XkbLayout"  "fr"
   Option "XkbVariant" "bepo"
   Option "XkbOptions" "kpdl:kposs,grp:sclk_toggle,compose:lwin"
EndSection

Section "InputClass"
  Identifier          "moonlander"
  MatchIsKeyboard     "yes"
  MatchVendor         "ZSA"
  Option "XkbModel"   "pc105"
  Option "XkbLayout"  "fr"
  Option "XkbVariant" "bepo"
EndSection

Section "InputClass"
  Identifier          "yubikey"
  MatchIsKeyboard     "yes"
  MatchVendor         "Yubico"
  Option "XkbModel"   "pc105"
  Option "XkbLayout"  "us"
  Option "XkbVariant" "basic"
EndSection
```

Currently Wayland is broken because only one layout is possible, and so I can't have the correct keyboard model (tm2030USB-102 / pc105) or layout (FR-BEPO / US / FR) based on the related physical keyboard.