rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.78k stars 166 forks source link

Laptop display is turned on when pressing the first key #300

Closed tamirzb closed 1 year ago

tamirzb commented 2 years ago

I find this issue a bit strange as I have no idea why/how this happens, but here it goes.

I am using a laptop whose lid is closed and is connected to an external display, therefore the laptop display is off. The first key I type after starting keyd causes the laptop display to turn on. As far as I can tell, this only happens when the laptop display is turned off due to the lid being closed. If I try to open the lid but manually turn off the display, this doesn't happen.

My window manager is sway (wayland) and my keyd config is fairly simple (switch between the ` and the esc keys):

[ids]
05ac:024f

[main]
esc = `
` = esc

Any idea why this happens or how can this be fixed?

rvaiya commented 2 years ago

If this happens immediately after starting keyd (but not otherwise), then my guess is that something in your input stack is responding to the presence of keyd's virtual keyboard (which is probably treats like any other external keyboard). You can test this theory by seeing if the problem also occurs when you plug in an external keyboard. If this is indeed the case, you will probably need to add a libinput quirk.

tamirzb commented 2 years ago

It doesn't happen when I plug in an external keyboard.

Also, note that this doesn't happen when I start keyd, but when I press the first key after starting keyd. Though I'm not sure at what point does keyd actually create the virtual keyboard.

herrsimon commented 2 years ago

So just to understand: You're saying that plugging in a physical keyboard and pressing a key keeps your screen blank, but starting keyd and pressing a key turns it on?

tamirzb commented 2 years ago

Yes, exactly

rvaiya commented 2 years ago

Does this only occur immediately after starting keyd? If you start keyd and press a key before closing your laptop lid, does a subsequent key press cause it to wake up?

It would also help if you could post the output of sudo keyd -m while replicating this behaviour (annotating the output to indicate where the problem occurs).

tamirzb commented 2 years ago

Yes, if I start keyd and press some keys, then close the laptop lid and press a key again I get the same behavior.

Here is the output of sudo keyd -m with annotations of what's happening:

device added: 05ac:024f (Keychron K6)
device added: 046d:c05a (Logitech USB Optical Mouse)
device added: 0000:0000 (DP-4)
device added: 0002:0006 (ImExPS/2 Generic Explorer Mouse)
device added: 093a:0274 (PIXA3854:00 093A:0274 Touchpad)
device added: 093a:0274 (PIXA3854:00 093A:0274 Mouse)
device added: 32ac:0006 (FRMW0001:00 32AC:0006 Consumer Control)
device added: 0001:0001 (AT Translated Set 2 keyboard)
Keychron K6 05ac:024f   up down
Keychron K6 05ac:024f   up up
Keychron K6 05ac:024f   enter down
***** keyd is starting
device added: 0fac:0ade (keyd virtual device)
device added: 0fac:1ade (keyd virtual pointer)
ioctl: Invalid argument
ioctl EVIOCGNAME: Invalid argument
ioctl: Inappropriate ioctl for device
ioctl EVIOCGNAME: Inappropriate ioctl for device
Keychron K6 05ac:024f   enter up
***** I press the enter key
keyd virtual device 0fac:0ade   enter down
***** The laptop display turns on
keyd virtual device 0fac:0ade   enter up
tamirzb commented 1 year ago

Been some time since I tried using keyd so I thought I'd give it another go. Seems like this issue doesn't happen anymore. Still not sure what caused it, but I guess some update to keyd or sway (or something else?) fixed it.