According to this page I can have two different physical keyboards attached and have a different layout on each of them. I need German on one, and Danish on the other, so this would be a very elegant solution.
However, my xinput
command output does not show me two keyboards; the wireless Logitech K230 keyboard is listed as a pointer because it uses the Logitech "Unifying Receiver" that also receives my wireless mouse. Also, the USB keyboard is shown as id 11 and 12?
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech K230 id=8 [slave pointer (2)]
⎜ ↳ Logitech M705 id=9 [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)]
↳ Sleep Button id=7 [slave keyboard (3)]
↳ UVC Camera (046d:0991) id=10 [slave keyboard (3)]
↳ SINO WEALTH USB Keyboard id=11 [slave keyboard (3)]
↳ SINO WEALTH USB Keyboard id=12 [slave keyboard (3)]
I have discovered that I can use setxkbmap
on device 3
to affect both keyboards at once.
setxkbmap -device 11 at
also affects device 8 (the Logitech keyboard).
setxkbmap -device 8 dk
works - but only until I type anything at all on the USB keyboard! From then on, both keyboards have the at
layout.
- How do I assign different layouts to these two keyboards?
- Why does using one keyboard affect the other keyboard?
This unanswered question from 2017 says that "Apparently, the [Logitech keyboard] has no layout of [its] own... it just uses the layout of the last keyboard that has been used." Since nobody has answered there, perhaps that is really an unsolvable problem? Perhaps specific to Logitech?
xkbcomp
with the-i
flag to identify the id of each keyboard. However, that seems to be essentially what you've done, only with thexkbcomp
command rather than thesetxkbmap
command. You could trysetxkbmap at -print | xkbcomp -i 11 $DISPLAY
andsetxkbmap dk -print | setxkbmap dk -print | xkbcomp -i 8 $DISPLAY
, but I'm not sure if it'd be any different. For me, both keyboard show up under the "Virtual core keyboard" section, so that might have something to do with it. – ElliotThomas Aug 28 '22 at 19:00