oblitum / caps2esc

Transforming the most useless key ever in the most useful one
GNU General Public License v3.0
166 stars 37 forks source link

Also capture mouse scroll event #5

Closed HarmtH closed 3 years ago

HarmtH commented 7 years ago

I'm also using the capslock key nowadays for control-scrolling (in most programs mapped to zoom in/out). However, the capslock doesn't turn into a control key until the repeat timeout expires, so I have to wait about half a second before I can scroll. Is it possible to also listen to mouse scroll events and start being a control key when the mouse is scrolled?

oblitum commented 7 years ago

It should be possible, but I'll have to take a look. At the moment when caps is pressed, nothing happens, the keydown event is delayed until there's a release, or another key gets pressed (or repeat timeout expires, generating key events). Adding that would mean to capture mouse events too and taking action on that, it should be optional because sometimes touchpads may be triggered without intent.

adriaanzon commented 7 years ago

Click events would be good to have too.

Normally when ctrl+clicking a link in a browser, it opens in a new tab. With caps2esc, the ctrl key doesn't get sent, but the escape key does get sent, which results in the link being canceled.

vyp commented 6 years ago

This is maybe a bit off topic, but with interception-tools caps2esc, ctrl+clicking seems to work for me. Not sure about ctrl+scrolling though. (How can I test that?)

oblitum commented 6 years ago

@vyp if it's working for you, it's undefined behavior. I didn't program any version to do that, so looking for testing this to be working at the moment isn't covered nor supported from my side.

HarmtH commented 6 years ago

After holding capslock for a certain time, the repeat mechanism triggers (I guess it's this one https://github.com/jiixyj/libevdev/blob/master/include/linux/input.h#L118), caps2esc sees another capslock press and transmits a control press.

So after the repeat delay you can control-click or control-scroll. If you cannot I guess repeating is turned off.

I have tried to make the control press immediate after a mouse scroll (or click), but this turned out to be not that trivial at all, so I gave up. Maybe I will give it another shot later.

oblitum commented 6 years ago

@HarmtH I've looked to remove the CTRL on repeat behavior back in April, it shouldn't be happening anymore. Are you using an older version?

HarmtH commented 6 years ago

Yes pretty old version, because I changed the code such that it didn't change the escape key behaviour (who needs capslock anyway). And I think if the 'long press for control' 'feature' is gone I will stay on this version.

vyp commented 6 years ago

I would just like to mention that it seems as though I was incorrect when I said that ctrl+clicking was working for me, because it actually isn't working for me (which is expected though I think). I think I said that because I was testing using the left control key and not the caps lock key.

oblitum commented 3 years ago

Fixed at https://gitlab.com/interception/linux/plugins/caps2esc/-/issues/9. caps2esc standalone isn't supported anymore, Interception Tools is necessary.