jordansissel / xdotool

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

modifier_map to replace caps lock with control breaks --clearmodifier #470

Open gcb opened 1 month ago

gcb commented 1 month ago

on kde, making capslock an addition control, impacts modifier handling in a way i cannot work around.

image

There is a lot of good information of what this setting is doing underneath at https://discuss.kde.org/t/ctrl-remap-question/4613/2 And I think I was doing the thing that was easier for xdotool... I.e. sending a regular Control_L signal.

Here's what is happening. I am trying to implement a sort of lazy-vim mode. where ctrl+j outputs arrow-down, etc.

xdotool key --clearmodifiers Down will register Ctrl+Down everywhere, no matter which the three controls I now have (left, right, capslock). With the extra issue that if I do press caps lock, not only i get Ctrl+down, but control gets stuck as in #43

If I use a more complex incantation:

/usr/bin/xdotool keyup Control keyup Control_L keyup Control_R keydown --clearmodifiers Down
/usr/bin/xdotool keyup --clearmodifiers Down

Now the original control keys work fine (but i have to let go of them and press then again to get a control signal). And the capslock (as control) still gives me Ctrl+Down!!

as far as I can tell it should be sending the L_Control signal

xkb_symbols "nocaps" {
    replace key <CAPS> { [ Control_L, Control_L ] };
    modifier_map  Control { <CAPS>, <LCTL> };
};

But I do seem to have a third keysym on my system, two left control...

$ xmodmap 
...
control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69)