add a second keyboard with a different mapping

Peter Hutterer peter.hutterer at
Mon Jul 20 21:00:59 PDT 2009

On Mon, Jul 20, 2009 at 02:32:35PM +0000, Lennart Aangeenbrug wrote:
> Hi all,How can i add a second USB keyboard, and map this
> keyboard differently? The main keyboard is connected to PS/2, works fine
> etc. The second one is working out of the box. I want to use the second
> keyboard for Gimp and re-map some keys (like Q should be CTRL-SHIFT-N). So
> my question is : how can i re-map the keys on the second keyboard? I think i
> should add the keyboard to xorg, but i can't figure it out.
> The Xorg.conf (i'm working under Ubuntu 8.04) shows only
> Section "InputDevice"
>     # generated from default
>     Identifier     "Keyboard0"
>     Driver         "kbd"
> EndSection

if you need two separate keyboards, you shouldn't use the kbd driver. Use
evdev instead (there are be plenty of links on google to explain how to use
evdev). use a device file of /dev/input/by-id/<keyboard name>-event and
assign it the desired Option "XkbLayout", etc. in the config.
It is also possible to set up two keyboards, one with the kbd driver and one
with evdev (grabs must be enabled in evdev, evdev 2.1 and later requires
Option "GrabDevice" "on").

Note that depending on your desktop enviroment, the layout set in the config
may get overwritten so you may need to apply the layout at runtime anyway.
This can be done with "setxkbmap -device <deviceid> -layout <whatever>" etc.


More information about the xorg mailing list