Keyboard shortcuts stop working after reconnecting the USB keyboard when .Xmodmap is present

I'm using xfce. The issue isn't new, but I've finally figured out what causes it (thanks this topic ) and have learned to reproduce it with 100% accuracy.

Namely: if I have an .Xmodmap present, and use an external USB keyboard and plug it out and back in, all custom keyboard shortcuts stop working for like 2 minutes, while Xorg CPU usage jumps to 100%. After the 2 minutes all previously entered keyboard shortcuts are executed in rapid succession.

Removing ~/.Xmodmap entirely resolves the issue.

I have successfully reproduced it on two machines, here's the inxi -Fx output from one of them:

Resuming in non X mode: xdpyinfo not found. For package install advice run: inxi --recommends
System:    Host: manjaro Kernel: 4.14.15-1-rt12-MANJARO x86_64 bits: 64 gcc: 7.2.1
           Desktop: Xfce 4.12.4 (Gtk 2.24.31) Distro: Manjaro Linux
Machine:   Device: laptop System: SAMSUNG product: 900X3C/900X4C/900X4D v: 0.1 serial: N/A
           Mobo: SAMSUNG model: SAMSUNG_NP1234567890 v: FAB1 serial: N/A
           UEFI [Legacy]: Phoenix v: P02AAC date: 06/01/2012
Battery    BAT1: charge: 26.6 Wh 80.0% condition: 33.3/40.3 Wh (83%) model: SAMSUNG status: N/A
CPU:       Dual core Intel Core i5-3317U (-MT-MCP-) arch: Ivy Bridge rev.9 cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 6784
           clock speeds: max: 2600 MHz 1: 2288 MHz 2: 2394 MHz 3: 1583 MHz 4: 2273 MHz
Graphics:  Card: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0
           Display Server: N/A drivers: intel (unloaded: vesa) tty size: 211x59
Audio:     Card-1 Intel 7 Series/C216 Family High Definition Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Card-2 Logitech Webcam C270 driver: USB Audio usb-ID: 002-034
           Sound: Advanced Linux Sound Architecture v: k4.14.15-1-rt12-MANJARO
Network:   Card-1: Intel Centrino Advanced-N 6235 driver: iwlwifi bus-ID: 01:00.0
           IF: wlp1s0 state: up mac: c4:85:08:60:af:31
           Card-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: 2000 bus-ID: 02:00.0
           IF: enp2s0 state: down mac: e8:03:9a:dc:02:28
Drives:    HDD Total Size: 1240.2GB (7.6% used)
           ID-1: /dev/sda model: KINGSTON_SMS200S size: 240.1GB
           ID-2: USB /dev/sdb model: Elements_10A8 size: 1000.2GB
Partition: ID-1: / size: 219G used: 88G (43%) fs: ext4 dev: /dev/dm-0
           ID-2: /boot size: 488M used: 126M (28%) fs: ext4 dev: /dev/sda1
Sensors:   System Temperatures: cpu: 73.0C mobo: 29.8C
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 236 Uptime: 5 min Memory: 1261.9/3651.6MB Init: systemd Gcc sys: 7.2.1
           Client: Shell (bash 4.4.121) inxi: 2.3.56 

How big is your Xmodmap? I did find one article about a 20 second delay in booting with xmodmap, and they reduced it by just including the differences from the output of xmodmap -kpe in their .Xmodmap.

I gotta give it to you for persistence, at least it is a very narrow target now. :smiley:

I read more online and figured out that xmodmap is outdated and buggy, so I decided to use something else for the keybord modification I'm using. Following this tutorial I managed to do this with xkb:

Now it works properly - I've added

xkbcomp -I$HOME/.xkb ~/.xkb/keymap/mykbd $DISPLAY

as a startup command.

The only issue is that the mapping is reset once I reconnect the keyboard. But the keyboard shortcuts remain intact. So I've just mapped the remapping command to a keyboard shortcut and can fix it in an instant when in need :wink:

BTW, the mapping I use is very simple - I just replace Caps Lock with a second Return. I highly recommend it :wink:

I tested this already and it was 15 seconds or less, If you are claiming this same problem as your other thread then please present some real information about the time delay of two minutes.

I do agree that any delay seems odd. :smiley:

I'm not using Xmodmap at all but unfortunately I have similar symptoms as you - after reconnecting USB keyboard I have about half minute long timeout (Xorg is on a peak and no hotkeys).

EDIT: I'm using secondary keyboard layout. When I remove this layout and leave only one, problem after USB reconnecting disappeared.

EDIT 2: Problem can be also simulated by adding or removing keyboard layout.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by