alols / xcape

Linux utility to configure modifier keys to act as other keys when pressed and released on their own.
GNU General Public License v3.0
2.1k stars 117 forks source link

Stop catching events on remapped CAPSLOCK after some time #83

Open andrewmed opened 7 years ago

andrewmed commented 7 years ago

Hi On Debian I remap CAPSLOCK to use it as CTRL In /etc/default/keyboard :

XKBOPTIONS="ctrl:nocaps,grp:sclk_toggle,grp:lwin_switch,grp_led:scroll,altwin:alt_super_win"

xcape catches it OK as CTRL just after start:

Intercepted key event 3, key code 66
Key released!
Generating Escape!
Ignoring generated event.
Ignoring generated event.

after some time however it stop catching re-mapped CAPSLOCK:

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

original CTRL continues to work:

Intercepted key event 2, key code 37
Key pressed!
Intercepted key event 3, key code 37
Key released!
Generating Escape!
Ignoring generated event.
Ignoring generated event.

this is stable, cant use this nice program because of that :(

andrewmed commented 7 years ago

Well, the problem was to find the place where to call xcape from. By try and guess method I found that it works OK when run from Xsession.d script. (btw I tend to have several DISPLAY sessions open for the same user and use lightweight DM an i3 ) Another thing remains though: to make remapped CAPS work I always need to press CTRL first. No much trouble, but interesting. May be it is system-bound. I will look into that. Issue above can be closed I guess

NickHu commented 7 years ago

~Actually upon further inspection it seems that the only thing I need to do is hit my physical CTRL key for it to stop working...~

I was wrong, I have no idea what causes it. Hitting CTRL (which generates an Escape) does fix it though.

lewishsh commented 7 years ago

Also having this problem. @andrewmed do I understand you as saying that when called from a Xsession.d script it works fine? Any other possible places?

I can't tell what's causing this for me. It doesn't seem to be a matter of pressing the CTRL key--though that makes it work again.

Nadrieril commented 7 years ago

I have the same problem. It worked fine when I was remapping Caps -> Ctrl_L and Ctrl_L -> AltGr. However since I've started having only Caps -> Ctrl_L (via the ctrl:nocaps setting), xcape stops working after a while. Maybe having two Ctrl_L keys on the keyboard is the problem ?

bard commented 6 years ago

I worked around this by changing my ~/.xsession from:

# ...
xcape -e 'Control_L=Escape' -t 500
exec i3
# EOF

To:

# ...
i3 & wmpid=$!
sleep 5
xcape -e 'Control_L=Escape' -t 500
wait $wmpid
# EOF

i.e. starting xcape well after i3.

bobwhitelock commented 5 years ago

FWIW I tried tweaking in various ways where I called xcape to work around this issue, but could never completely prevent it periodically occurring.

I eventually found that switching to using https://gitlab.com/interception/linux/plugins/caps2esc/ instead of xcape for mapping Caps to both Esc and Ctrl works flawlessly, and prevents this being an issue. There's a section in the caps2esc README on the limitations of using xcape for doing this, which sounds like it might be related to this issue:

It's a simple solution but with many annoying drawbacks I couldn't stand in the end:

  • It resets any time a device change happens (bluetooth, usb, any) or the laptop lid is closed or when logging off and needs to be re-executed.
  • It depends on X. Doesn't work on TTY (bare terminal based machine, CTRL-ALT F2, etc).
ivanbrennan commented 4 years ago

Also experiencing this issue.

7dev70 commented 4 years ago

Also experiencing this issue. caps2esc also can't do what i want.

idontlikecreatingaccounts commented 10 months ago

Also on Debian, also experiencing this issue.

Mine only registers intermittently right from the start. It also seems to change depending on the software. Some software works more reliably, but none often enough to be usable.