jordansissel / xdotool

fake keyboard/mouse input, window management, and more
Other
3.18k stars 316 forks source link

key command clobbers keycode 8 #129

Closed acrisci closed 8 years ago

acrisci commented 8 years ago

Keycode 8 is clobbered by a command such as xdotool key Agrave when the given symbol is not in the keymap.

To reproduce:

With a US keyboard layout, put this entry in your ~/.Xmodmap

keycode 8 = PesetaSign

Now xmodmap ~/.Xmodmap.

We see it in the output of xmodmap -pk | head.

8 0x10020a7 (PesetaSign) 0x0000 (NoSymbol) 0x10020a7 (PesetaSign) 0x0000 (NoSymbol) 0x10020a7 (PesetaSign)

Now run xdotool key Agrave. Now when we run xmodmap -pk | head again, we see that keycode 8 has been clobbered.

8

The function xdo_send_keysequence_window_list_do() contains some code that is commented out. The logic is written such that it will always choose the lowest keycode available (in my case 8) even if there is already something there.

I'm worried that a machine might have something important on keycode 8 that xdotool will clobber. Might this be a problem?

jordansissel commented 8 years ago

Ahh, this is a bug. xdotool is supposed to find the first unused keycode in the keymap and use it as scratch space to temporarily map a keysym to a keycode so it can be typed. After typing that key, it should unmap/restore the keycode to its previously unused state.