Barrier: Wrong keyboard layout between Server and Client

Created on 22 Sep 2018  ·  4Comments  ·  Source: debauchee/barrier

Operating Systems

Server: Windows 10

Client: Arch Linux

Barrier Version

2.1.0

Steps to reproduce bug

  1. Set keyboard layout to IT on Server (Windows 10)
  2. Set keyboard layout to IT on Client (Arch Linux)
  3. Bug: barrier reverts to using EN keyboard layout on Client (Arch Linux)

Other info

  • When did the problem start to occur? Always
  • Is there a way to work around it? I don't know
  • Does this bug prevent you from using Barrier entirely? Not entirely but it's very annoying to have the wrong keyboard layout

Most helpful comment

I think this happens because the XTEST extension is used to deliver the keystrokes, and it has its own virtual keyboard. You can see this if you run xinput list:

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Broadcom Corp. Bluetooth USB Host Controller  id=11   [slave  pointer  (2)]
⎜   ↳ bcm5974                                   id=13   [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)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Broadcom Corp. Bluetooth USB Host Controller  id=10   [slave  keyboard (3)]

This can be fixed using setxkbmap -device N where N is the device number from this list.
I have solved this issue for now by putting the following in my .xinitrc:

setxkbmap -device `xinput list | grep "Virtual core XTEST keyboard" | sed -e 's/.\+=\([0-9]\+\).\+/\1/'` us colemak

This sets it to layout us, variant colemak. You can work out the correct values for your system, along with any -option settings, by issuing setxkbmap -query.

All 4 comments

I think this happens because the XTEST extension is used to deliver the keystrokes, and it has its own virtual keyboard. You can see this if you run xinput list:

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Broadcom Corp. Bluetooth USB Host Controller  id=11   [slave  pointer  (2)]
⎜   ↳ bcm5974                                   id=13   [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)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Broadcom Corp. Bluetooth USB Host Controller  id=10   [slave  keyboard (3)]

This can be fixed using setxkbmap -device N where N is the device number from this list.
I have solved this issue for now by putting the following in my .xinitrc:

setxkbmap -device `xinput list | grep "Virtual core XTEST keyboard" | sed -e 's/.\+=\([0-9]\+\).\+/\1/'` us colemak

This sets it to layout us, variant colemak. You can work out the correct values for your system, along with any -option settings, by issuing setxkbmap -query.

Really curious: if I use your method with us layout, i.e. with

setxkbmap -device `xinput list | grep "Virtual core XTEST keyboard" | sed -e 's/.\+=\([0-9]\+\).\+/\1/'` us

I get correct it layout (except for accented letters, but it is not a problem).
If I set it layout, it is completely wrong.

Anyway thank you very much for this workaround!

Now it works with it too, after a reboot...

that is awesome!, a couple of years ago I looking for this solution with no luck. Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings