Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Xorg: Two keyboards with different keyboard layout.
# Use xinput to find your keyboards.
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=11 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=12 [slave pointer (2)]
⎜ ↳ Logitech Performance MX id=14 [slave pointer (2)]
⎜ ↳ E-Signal USB Gaming Keyboard id=16 [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=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=13 [slave keyboard (3)]
↳ Sennheiser Sennheiser 3D G4ME1 id=15 [slave keyboard (3)]
↳ E-Signal USB Gaming Keyboard id=17 [slave keyboard (3)]
# My keyboards are id 10 (laptop integrated) and id 17 (external keyboard).
# Now, set my external keyboard to be Swedish layout, and my internal to Dvorak:
$ setxkbmap -device 17 se
$ setxkbmap -device 10 dvorak
# Done!

This comment has been minimized.

Copy link

mxa commented Jun 13, 2019

Is there a way to put this into a udev rule so it is automatic every time?
Problem being that the id changes often when USB devices are plugged in or unplugged. For a udev rule a vendor/product id solution would be suitable.


This comment has been minimized.

Copy link
Owner Author

hencjo commented Jun 13, 2019

Honestly, I have no idea because I don't know nearly enough about udev. I only use this sporadically when pairing, so I don't mind fiddling a bit beforehand. If you do find a persistent solution, I would be interested to learn how you did!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.