Skip to content

sway occassionally gets confused which keyboard layout should be used with which keyboard for xwayland Apps #4498

Open
@sanga

Description

I have my laptop connected though a thunderbolt dock to an external keyboard. My internal laptop is a finnish layout kb and the external one is a en-us layout kb. Sometimes it appears that sway gets confused and behaves as if the external keyboard was set to fi-fi layout. Hitting any key on my laptop keyboard will then "remind" sway that the external kb is in en-us layout. Also, it would appear that this bug only happens for xwayland apps.

swaymsg -t get_inputs (snipped out irrelevant stuff):

   {
     "identifier": "1241:17733:USB_Keyboard_System_Control",
     "name": "USB Keyboard System Control",
     "vendor": 1241,
     "product": 17733,
     "type": "keyboard",
     "xkb_layout_names": [
       "English (US)"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "English (US)",
     "libinput": {
       "send_events": "enabled"
     }
   },
   {
     "identifier": "1241:17733:USB_Keyboard_Consumer_Control",
     "name": "USB Keyboard Consumer Control",
     "vendor": 1241,
     "product": 17733,
     "type": "keyboard",
     "xkb_layout_names": [
       "English (US)"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "English (US)",
     "libinput": {
       "send_events": "enabled"
     }
   },
   {
     "identifier": "1241:17733:USB_Keyboard",
     "name": "USB Keyboard",
     "vendor": 1241,
     "product": 17733,
     "type": "keyboard",
     "xkb_layout_names": [
       "English (US)"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "English (US)",
     "libinput": {
       "send_events": "enabled"
     }
   },
   {
     "identifier": "6127:12394:Lenovo_ThinkPad_Thunderbolt_3_Dock_USB_Audio",
     "name": "Lenovo ThinkPad Thunderbolt 3 Dock USB Audio",
     "vendor": 6127,
     "product": 12394,
     "type": "keyboard",
     "xkb_layout_names": [
       "English (US)"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "English (US)",
     "libinput": {
       "send_events": "enabled"
     }
   },
   {
     "identifier": "6058:20564:ThinkPad_Extra_Buttons",
     "name": "ThinkPad Extra Buttons",
     "vendor": 6058,
     "product": 20564,
     "type": "keyboard",
     "xkb_layout_names": [
       "English (US)"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "English (US)",
     "libinput": {
       "send_events": "enabled"
     }
   },
   {
     "identifier": "1:1:AT_Translated_Set_2_keyboard",
     "name": "AT Translated Set 2 keyboard",
     "vendor": 1,
     "product": 1,
     "type": "keyboard",
     "xkb_layout_names": [
       "Finnish"
     ],
     "xkb_active_layout_index": 0,
     "xkb_active_layout_name": "Finnish",
     "libinput": {
       "send_events": "enabled"
     }
   }
 ]

relevant snip from config file

input "1:1:AT_Translated_Set_2_keyboard" {
    xkb_layout fi
    xkb_options ctrl:nocaps
}

input "1241:17733:USB_Keyboard" {
    xkb_layout us
    xkb_options ctrl:nocaps
}

input "2385:5815:Kingston_HyperX_Alloy_FPS_Mechanical_Gaming_Keyboard" {
    xkb_layout fi
    xkb_options ctrl:nocaps
}

version info:

sway version 1.2-rc1-19-gff7d979d (Aug 20 2019, branch 'master')
wlroots=e19f48d1e4cea6bbb8998466553fffda4bd13251

not sure if it's relevant but libinput is at

dpkg -l | rg libinput                          
ii  libinput-bin                               1.12.6-1                             amd64        input device management and event handling library - udev quirks
ii  libinput-dev:amd64                         1.12.6-1                             amd64        input device management and event handling library - development files
ii  libinput10:amd64                           1.12.6-1                             amd64        input device management and event handling library - shared library
ii  xserver-xorg-input-libinput                0.28.2-2                             amd64        X.Org X server -- libinput input driver

Apologies, I don't have logs for this at the moment. I'll try to dig them out later.

Incidentally is seems a little odd that Lenovo_ThinkPad_Thunderbolt_3_Dock_USB_Audio is detected as a keyboard and as such has a layout. Perhaps that's not related but I included it in case it somehow is.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions