Connecting external keyboard resets keyboard options of all keyboards
I'm using an US keyboard layout on my laptop and on an external keyboard. In addition, I disabled the CapsLock key to work as Ctrl and relocated the Compose key using Gnome-Tweaks.
Everything works as expected after I start a session or after using Gnome-Tweaks.
The problem is, that if I disconnect and reconnect the external keyboard during a session, the keyboard options for both keyboards are reset. CapsLock key works as CapsLock again and not Ctrl and Compose key is on the default Compose key. Again, this is on both keyboards.
When I just run Gome-Tweaks after a dis-/reconnect of the external keyboard, the keys works as expected (CapsLock is Ctrl, Compose is relocated)
What I can see in the logs:
kernel: input: Lenovo ThinkPad Compact USB Keyboard with TrackPoint as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:17EF:6047.0017/input/input40
gdm-x-session: (II) config/udev: Adding input device Lenovo ThinkPad Compact USB Keyboard with TrackPoint (/dev/input/mouse1)
gdm-x-session: (II) No input driver specified, ignoring this device.
gdm-x-session: (II) This device may have been added with another device file.
gdm-x-session: (II) config/udev: Adding input device Lenovo ThinkPad Compact USB Keyboard with TrackPoint (/dev/input/event6)
gdm-x-session: (**) Lenovo ThinkPad Compact USB Keyboard with TrackPoint: Applying InputClass "libinput pointer catchall"
gdm-x-session: (**) Lenovo ThinkPad Compact USB Keyboard with TrackPoint: Applying InputClass "libinput keyboard catchall"
gdm-x-session: (II) Using input driver 'libinput' for 'Lenovo ThinkPad Compact USB Keyboard with TrackPoint'
gdm-x-session: (II) systemd-logind: got fd for /dev/input/event6 13:70 fd 54 paused 0
gdm-x-session: (**) Lenovo ThinkPad Compact USB Keyboard with TrackPoint: always reports core events
gdm-x-session: (**) Option "Device" "/dev/input/event6"
gdm-x-session: (**) Option "_source" "server/udev"
gdm-x-session: (II) event6 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: is tagged by udev as: Keyboard Mouse Pointingstick
gdm-x-session: (II) event6 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: is an external pointing stick
gdm-x-session: (II) event6 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device is a pointer
gdm-x-session: (II) event6 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device is a keyboard
gdm-x-session: (II) event6 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device removed
gdm-x-session: (II) libinput: Lenovo ThinkPad Compact USB Keyboard with TrackPoint: needs a virtual subdevice
gdm-x-session: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:17EF:6047.0018/input/input41/event6"
[...]
gdm-x-session: (II) XINPUT: Adding extended input device "Lenovo ThinkPad Compact USB Keyboard with TrackPoint" (type: KEYBOARD, id 10)
gdm-x-session: (**) Option "xkb_layout" "us"
gdm-x-session: (II) config/udev: Adding input device Lenovo ThinkPad Compact USB Keyboard with TrackPoint (/dev/input/event5)
gdm-x-session: (**) Lenovo ThinkPad Compact USB Keyboard with TrackPoint: Applying InputClass "libinput keyboard catchall"
gdm-x-session: (II) Using input driver 'libinput' for 'Lenovo ThinkPad Compact USB Keyboard with TrackPoint'
gdm-x-session: (II) systemd-logind: got fd for /dev/input/event5 13:69 fd 59 paused 0
gdm-x-session: (**) Lenovo ThinkPad Compact USB Keyboard with TrackPoint: always reports core events
gdm-x-session: (**) Option "Device" "/dev/input/event5"
gdm-x-session: (**) Option "_source" "server/udev"
gdm-x-session: (II) event5 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: is tagged by udev as: Keyboard
gdm-x-session: (II) event5 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device is a keyboard
gdm-x-session: (II) event5 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device removed
gdm-x-session: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:17EF:6047.0017/input/input40/event5"
gdm-x-session: (II) XINPUT: Adding extended input device "Lenovo ThinkPad Compact USB Keyboard with TrackPoint" (type: KEYBOARD, id 17)
gdm-x-session: (**) Option "xkb_layout" "us"
gdm-x-session: (II) event5 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: is tagged by udev as: Keyboard
gdm-x-session: (II) event5 - Lenovo ThinkPad Compact USB Keyboard with TrackPoint: device is a keyboard
These are my gsettings:
org.gnome.desktop.input-sources xkb-options ['ctrl:nocaps', 'caps:ctrl_modifier', 'compose:rctrl']
org.gnome.desktop.input-sources mru-sources [('xkb', 'us'), ('ibus', 'm17n:t:latn-pre')]
org.gnome.desktop.input-sources show-all-sources false
org.gnome.desktop.input-sources current uint32 0
org.gnome.desktop.input-sources per-window false
org.gnome.desktop.input-sources sources [('xkb', 'us')]
Some info on my setup:
{
"Version": "20.04",
"OEM": {
"Vendor": "LENOVO",
"Family": "ThinkPad T490"
},
"Arch": "amd64",
"Session": {
"DE": "ubuntu:GNOME",
"Name": "ubuntu",
"Type": "x11"
},
"Language": "en_GB",
}
Some package versions:
gdm3 3.36.3-0ubuntu0.20.04.1
gnome-tweak-tool 3.34.0-2ubuntu1
gnome-tweaks 3.34.0-2ubuntu1
libva-wayland2 2.7.0-2
libwayland-client0 1.18.0-1
libwayland-cursor0 1.18.0-1
libwayland-egl1 1.18.0-1
libwayland-server0 1.18.0-1
libxcb-xinput0 1.14-2
xinput 1.6.3-1
xwayland 2:1.20.8-2ubuntu2.4