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

capslock = overload(control, esc) ignores scroll wheel events #841

Open
nnsee opened this issue Sep 21, 2024 · 8 comments
Open

capslock = overload(control, esc) ignores scroll wheel events #841

nnsee opened this issue Sep 21, 2024 · 8 comments

Comments

@nnsee
Copy link

nnsee commented Sep 21, 2024

Minimal example config:

[ids]
*

[main]
capslock = overload(control, esc)

When holding caps lock, pressing any keyboard key, and releasing caps lock, only CTRL keys are emitted. When pressing and releasing caps lock without pressing any key, CTRL down+up and ESC down+up events are emitted in rapid succession. This is expected behavior and works as intended.

However, when caps lock is held, the scroll wheel is used (but no key is pressed), and caps lock is released, then keyd also emits ESC (confirmed via keyd monitor). This shouldn't happen.

CTRL + scrollwheel is commonly used for zooming in and out, and may often be the only way to scroll in some interface using the keyboard without clicking. For example, the embedded version of the Google Maps widget found on many webpages.

I noticed this in the Google Cloud Maps API page, where an example embedded map is displayed inside a modal. Pressing escape closes the modal, while CTRL + scrollwheel zooms the modal. Using the remapped caps lock key to zoom closes the modal as well as zooming.

@bubbleguuum
Copy link

bubbleguuum commented Sep 26, 2024

I cannot reproduce this either in Firefox or my IDE: CTRL (CapsLock) + scrollwheel does not generate a ESC event (confirmed with keyd monitor). That's with version 2.5.0.

@nnsee
Copy link
Author

nnsee commented Sep 26, 2024

What model mouse do you have? I have an MX Master 3, for which the mouse wheel generates "high accuracy" scroll events, maybe that's the issue.

@bubbleguuum
Copy link

I also have a MX Master 3. If that matters, I'm on kernel 6.10.11, Xorg and i3 Window Manager. xinput lists the mouse in the Virtual core pointer section as keyd virtual pointer.

@nnsee
Copy link
Author

nnsee commented Sep 27, 2024

So this is interesting. I booted up my PC to see that the keyd keybindings didn't work. The keyd service was running normally, and even restarting didn't work. It was only until I unplugged and replugged my keyboard did it start working again.

Now, you'd think this is a separate issue to the one I'm describing here, but bear with me.

By looking at the logs, I can see that the MX Master mouse was never picked up initially. Neither when the service started, nor when I restarted it. It was only until I disconnected the keyboard did the mouse get detected.

Wondering if this somehow fixed the issue I described in the original post - it in fact did. Just like bubbleguuum, I can no longer reproduce this. Since this issue seems to be sporadic, it will pop up again and I'll report back when it does.

Interestingly, now the scrollwheel events show up in keyd monitor as well, which they didn't when I initially wrote this issue. I think the root cause, then, was that the MX Master 3 was not picked up by keyd at all, which resulted in the issue I was describing.

For reference, here are the service logs for the keyd daemon. 09:27:40 is when I initially booted my machine, 09:28:51 is when the service was restarted, 09:29:16 was when I disconnected my keyboard and the mouse was suddenly detected by keyd, and 09:29:23 was me replugging the keyboard.

Sep 27 09:27:40 lafleur systemd[1]: Started key remapping daemon.
Sep 27 09:27:40 lafleur keyd[1284]: CONFIG: parsing /etc/keyd/default.conf
Sep 27 09:27:40 lafleur keyd[1284]: Starting keyd v2.5.0 ()
Sep 27 09:27:40 lafleur keyd[1284]: DEVICE: match    0000:0006:bdb72f48  /etc/keyd/default.conf        (Video Bus)
Sep 27 09:27:40 lafleur keyd[1284]: DEVICE: match    0001:0001:a38e6885  /etc/keyd/default.conf        (AT Translated Set 2 keyboard)
Sep 27 09:27:40 lafleur keyd[1284]: DEVICE: match    17aa:5054:684df527  /etc/keyd/default.conf        (ThinkPad Extra Buttons)
Sep 27 09:28:51 lafleur systemd[1]: Stopping key remapping daemon...
Sep 27 09:28:51 lafleur systemd[1]: keyd.service: Main process exited, code=exited, status=15/n/a
Sep 27 09:28:51 lafleur systemd[1]: keyd.service: Failed with result 'exit-code'.
Sep 27 09:28:51 lafleur systemd[1]: Stopped key remapping daemon.
Sep 27 09:28:51 lafleur systemd[1]: keyd.service: Consumed 1min 10.366s CPU time, 3.8M memory peak.
Sep 27 09:28:51 lafleur systemd[1]: Started key remapping daemon.
Sep 27 09:28:51 lafleur keyd[2733]: CONFIG: parsing /etc/keyd/default.conf
Sep 27 09:28:51 lafleur keyd[2733]: Starting keyd v2.5.0 ()
Sep 27 09:28:51 lafleur keyd[2733]: DEVICE: match    0000:0006:bdb72f48  /etc/keyd/default.conf        (Video Bus)
Sep 27 09:28:51 lafleur keyd[2733]: DEVICE: match    0001:0001:a38e6885  /etc/keyd/default.conf        (AT Translated Set 2 keyboard)
Sep 27 09:28:51 lafleur keyd[2733]: DEVICE: match    17aa:5054:684df527  /etc/keyd/default.conf        (ThinkPad Extra Buttons)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: match    0f39:8872:3d161e8d  /etc/keyd/default.conf        (Heng Yu Technology IBM87P)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: match    0f39:8872:c1370fa4  /etc/keyd/default.conf        (Heng Yu Technology IBM87P Consumer Control)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: ignoring 04f3:3195:8faff923  (ELAN0676:00 04F3:3195 Mouse)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: ignoring 04f3:3195:db318731  (ELAN0676:00 04F3:3195 Touchpad)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: ignoring 0002:000a:83b21bac  (TPPS/2 Elan TrackPoint)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: match    046d:4082:5e9a6a68  /etc/keyd/default.conf        (Logitech MX Master 3)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: ignoring 0fac:1ade:d2b36ae6  (keyd virtual pointer)
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: removed        0f39:8872:3d161e8d Heng Yu Technology IBM87P
Sep 27 09:29:16 lafleur keyd[2733]: DEVICE: removed        0f39:8872:c1370fa4 Heng Yu Technology IBM87P Consumer Control
Sep 27 09:29:23 lafleur keyd[2733]: DEVICE: match    0f39:8872:3d161e8d  /etc/keyd/default.conf        (Heng Yu Technology IBM87P)
Sep 27 09:29:23 lafleur keyd[2733]: DEVICE: match    0f39:8872:c1370fa4  /etc/keyd/default.conf        (Heng Yu Technology IBM87P Consumer Control)

@bubbleguuum
Copy link

bubbleguuum commented Sep 27, 2024

Yes it seems related to the external keyboard.
I do not have one as I just use my ThinkPad keyboard + MX Master 3 (connected with the Logitech USB unifying receiver),
and have no problem: after boot, keyd is working properly.
However, for the mouse, keyd monitor does not log scroll wheel events, only mouse button presses. I do not know if it is supposed to report mouse wheel events or not but it does not prevent CapsLock (CTRL) + Mousewheel to work properly (not emit an ESC event).

@Piripuz
Copy link

Piripuz commented Sep 27, 2024

Maybe (as suggested in #815) you should just explicitly ask keyd to pick your mouse up in the [ids] section: as specified in the manual, the wildcard only matches keyboards and events from the mouse are thus not considered.
(This at least solved the problem in my case!)

@nnsee
Copy link
Author

nnsee commented Sep 29, 2024

If that's the case, then my mouse should've never been picked up and that's another bug in keyd.

@nnsee
Copy link
Author

nnsee commented Oct 24, 2024

FWIW, I changed keyboard to an MX Keys and I'm still having this issue.

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