Multiple simultaneous keyboards with unique layouts
As the title says, I'm interested in two (or more) simultaneous keyboards, each with a unique layout.
Everything I've researched indicates this should be possible, but I'm unable to get it to work. Regardless of how I set things up, all keyboards consistently operate as if they share the CoreDevice setting in xorg.conf. For example:
Code:
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Keyboard1"
Option "Xinerama" "0"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "evdev"
Option "CoreKeyboard"
Option "Device" "/dev/input/event3"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Keyboard1"
Driver "evdev"
Option "Device" "/dev/input/event4"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "ad"
EndSection
In the above config, both keyboards behave as if they're set for the USA layout. Changing the layout in gnome-keyboard-properties affects all of the connected keyboards equally, but has no provision for altering individual devices.
Any suggestions?
Re: Multiple simultaneous keyboards with unique layouts
Solved.
Depending on what you're trying to do, this can be two or three steps.
1.) Determine which layout will be assigned to each keyboard.
2.) [Optional] create a new keyboard layout if you're after a custom one (I recommend simply altered an existing layout).
3.) Use the setxkbmap command with the -device tag to apply your keyboard maps to the relevant devices. If you don't know your device, start with 1 and work your way up. Be prepared to undo your change by repeating it with your current layout. For example, typing
Code:
setxkbmap -device 3 af
sets both of my keyboards to Farsi, and typing
Code:
setxkbmap -device 3 us
sets them both back to US. It's probably best to have this line copied and ready to paste before every change to easily undo your changes.
In my case, I altered the Andorra keyboard layout with my custom, and applied it thusly:
Code:
setxkbmap -device 7 ad
And that's it! Each keyboard is operating simultaneously with a unique layout. Typing on each results in the keys I want and there is no switching or hotkeys required to make this change.