Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caps_Lock=Escape generates both Caps Lock and Escape #112

Open
Osse opened this issue Feb 14, 2019 · 3 comments
Open

Caps_Lock=Escape generates both Caps Lock and Escape #112

Osse opened this issue Feb 14, 2019 · 3 comments

Comments

@Osse
Copy link

Osse commented Feb 14, 2019

I am tryin to map Caps Lock to Escape using xcape -e Caps_Lock=Escape. It generates an Escape event (I go to normal mode in Vim etc.) but Caps lock is still switched on afterwards. I have included some xev output at the end of the issue.

This is an Arch Linux but it is running inside VirtualBox. Not sure if that is supposed to affect things.

KeyPress event, serial 28, synthetic NO, window 0x1e00001,
    root 0x3ad, subw 0x0, time 1158598, (224,181), root:(1668,741),
    state 0x0, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1e00001,
    root 0x3ad, subw 0x0, time 1158692, (224,181), root:(1668,741),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 28, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

KeyPress event, serial 28, synthetic NO, window 0x1e00001,
    root 0x3ad, subw 0x0, time 1158692, (224,181), root:(1668,741),
    state 0x2, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
mbLookupString gives 1 bytes: (1b) "
FilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1e00001,
    root 0x3ad, subw 0x0, time 1158692, (224,181), root:(1668,741),
    state 0x2, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
FilterEvent returns: False
@Osse
Copy link
Author

Osse commented Feb 14, 2019

I get the equivalent behavior using the default map expression, namely that Control_L is pressed and released first, then Escape.

@Liblor
Copy link

Liblor commented Jun 11, 2019

Edit: I just realized that I had several instances of xcape running... Naturally it didn't work as expected.

I have the same problem on Fedora 30:

xcape debug output:

Intercepted key event 2, key code 66
Intercepted key event 3, key code 66
Intercepted key event 2, key code 9
Intercepted key event 3, key code 9
Intercepted key event 2, key code 9
Intercepted key event 3, key code 9

@neoromantique
Copy link

neoromantique commented Mar 21, 2024

Same behaviour on x11/i3

~ 
❯ pgrep xcape
364775

~ 
❯ killall xcape

~ 
❯ xcape -d -e 'Caps_Lock=Escape'
Assigned mapping from "Caps_Lock" ( keysym 0xffe5, key code 66)
to "Escape" (keysym 0xff1b, key code 9)
sig_handler running...
Intercepted key event 3, key code 36
Intercepted key event 2, key code 66
Key pressed!
Intercepted key event 3, key code 66
Key released!
Generating Escape!
Ignoring generated event.
Ignoring generated event.
^[Intercepted key event 2, key code 66
Key pressed!
Intercepted key event 3, key code 66
Key released!
Generating Escape!
Ignoring generated event.
Ignoring generated event.
^[Intercepted key event 2, key code 37

Yet caps is being triggered

EDIT:
This works as a workaround:

setxkbmap -option 'caps:ctrl_modifier' && xcape -e 'Caps_Lock=Escape' &

(from: https://askubuntu.com/a/750535)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants