All we need is an easy explanation of the problem, so here it is.
I have two keyboards: an old ps/2 one and a usb one. I want the usb keyboard to have the us layout (or prefferably have the usb keyboard follow the layout chosen in gnome) and the ps/2 one to have a custom layout (shortcuts and other things :D). I’ve tried to set seperate layouts on each keyboard at runtime using
setxkbmap -device 8 -layout ru (russian layout to test), but this sets the layout on all keyboards to russian.
[email protected]:~$ xinput -list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ MOSART Semi. Wireless Keyboard & Mouse id=9 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id=11 [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)] ↳ Power Button id=7 [slave keyboard (3)] ↳ MOSART Semi. Wireless Keyboard & Mouse id=8 [slave keyboard (3)] ↳ Eee PC WMI hotkeys id=12 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
Found the part of the answer:
When you specify the layout for a device, you have to include all the layouts you want on all the hardware. So if I want russian on device 2 and US english on 3 then I need to use “ru,us” when specifiying the layout for device 2 and us,ru for device 3. Like this
setxkbmap -device 2 -layout ru,us setxkbmap -device 3 -layout us,ru
I still need to get this on startup and make a custom layout. Help with that would be much appreciated.
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
You need to use
xinput –create-master SecondKeyboard
to create a separate master keyboard, and then reattach the second keyboard to the new master:
xinput –reattach “Keyboard Id” “Master Id”
You use the ids from
This way the keyboards are separate and can be treated exclusively. E.g. you have two focuses, you can write in two applications at the same time with two keyboards, and set different key mappings, by specifying different master ids in things like setxkbmap.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂