Home » Questions » Computers [ Ask a new question ]

Two keyboards on one computer. When I write with A I want a US keyboard layout, when I use B I want Swedish. Possible?

Two keyboards on one computer. When I write with A I want a US keyboard layout, when I use B I want Swedish. Possible?

I have a laptop which I use an external keyboard with. When I type using the external keyboard I want to use a US keyboard layout, since that's the type of external keyboard I have. On the other hand, when I type using the integrated keyboard I'd like to use a Swedish layout.

Asked by: Guest | Views: 298
Total answers/comments: 2
Guest [Entry]

"Although this question is a tad old, I'd thought I'd share my solution since none of the other answers addressed how to have this work on boot.

My situation:
I have a Happy Hacking Keyboard that plugs in via usb that has keys moved around (control where caps lock is, etc). I use this most of the time, but sometimes I would like to use the standard laptop keyboard or another usb keyboard. For these keyboards I created a custom keyboard layout.

The trick is that the custom keyboard layout should not be applied to the Happy Hacking Keyboard.

Solution:
I created a Xorg config file as such:

$ cat /etc/X11/xorg.conf.d/30-keyboard.conf
Section ""InputClass""
Identifier ""Happily Hacked Keyboard""
MatchDevicePath ""/dev/input/event*""
MatchIsKeyboard ""on""
Driver ""evdev""

Option ""XkbLayout"" ""us""
Option ""XkbVariant"" ""hhk""
EndSection

Section ""InputClass""
Identifier ""Happy Hacking Keyboard""
MatchIsKeyboard ""on""
MatchVendor ""Topre_Corporation""
Driver ""evdev""

Option ""XkbLayout"" ""us""
Option ""XkbVariant"" ""basic""
EndSection

The first part basically says for any standard keyboard, apply the us layout with the the custom variant. The second part says for the happy hacking keyboard, use the us layout with the basic variant.

You can match devices based on a bunch of parameters: xorg doc"
Guest [Entry]

"I have the same situation, a laptop with a Brazilian keyboard and a German external keyboard.
My solution was to add two setxkbmap calls, but the tricky part here is to add all the layouts you need on both calls:
setxkbmap -device 12 -layout de,br
setxkbmap -device 14 -layout br,de

Device 12 is the external german keyboard whille device 14 is the laptop's brazilian keyboard."