rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.87k stars 170 forks source link

layer_indicator activates a CTRL layer #562

Open agenbite opened 1 year ago

agenbite commented 1 year ago

This is my config:

[ids]

k:0001:0001

[global]

layer_indicator = 1

[main]

# CapsLock behaves as ESC if tapped, and as Meta if held.
capslock = overload(meta, esc)

# Hold space to navigate with hjkl
space = timeout(overload(nav, space), 500, space)

# Tapping both shift keys simultaneously will activate CapsLock
leftshift+rightshift = capslock

[nav]
h = left
k = up
j = down
l = right
a = home
s = pagedown
d = end
q = ins
w = pageup

Now, if I hit CTRL+Print, I get into what seems like an undefined layer where CTRL is always activated. After some testing, I came to the conclusion that this effect is dependent on layer_indicator: if I comment out that line, I don't get it anymore.

I use a Thinkpad X1 Carbon (gen6) with Ubuntu 23.04, kernel 6.2.0-27-generic, and I'm otherwise very thankful and quite happy with keyd. :)

tkna91 commented 1 year ago

Let's display the debug logs for now Can you find any interesting logs when you perform the same operation after the following?

# systemctl stop keyd
# KEYD_DEBUG=1 keyd
agenbite commented 1 year ago

Ok, this is what I get if I press (right) CTRL and PrintScreen at the same time without layer_indicator=1:

DEBUG: src/daemon.c:429: input rightcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol down
DEBUG: src/daemon.c:429: input sysrq down
DEBUG: src/vkbd/uinput.c:324: output sysrq down
^[[57361;5uDEBUG: src/daemon.c:429: input rightcontrol up
DEBUG: src/keyboard.c:245: Deactivating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol up
DEBUG: src/daemon.c:429: input sysrq up
DEBUG: src/vkbd/uinput.c:324: output sysrq up

And this is what I get if I have layer_indicator=1 in my config:

DEBUG: src/daemon.c:429: input rightcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol down

This doesn't happen always. It depends on how I press the two keys together, but I haven't been able to find out what's the trigger: I tried pressing CTRL and then PrintScreen, also PrintScreen and then CTRL, and pressing both very fastly. The effect appears sometimes but always only in the later case (both keys pressed at the same time).

I wish I could give more precise info.

tkna91 commented 1 year ago

How about KEYD_DEBUG=2 keyd? Sorry if it makes no difference.

agenbite commented 1 year ago

Here's a series of three CTRL+PrintScreen presses. The first two do not hang up in the CTRL-layer while the third one does:

DEBUG: src/keyd.c:230: Debug mode activated
CONFIG: parsing /etc/keyd/default.conf
Starting keyd v2.4.3 (201a077)
DEBUG: src/device.c:121: capabilities of /dev/input/event15 (Integrated Camera: Integrated C): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event14 (HDA Intel PCH HDMI/DP,pcm=8): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event13 (HDA Intel PCH HDMI/DP,pcm=7): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event8 (keyd virtual pointer): 3
DEBUG: src/device.c:121: capabilities of /dev/input/event7 (keyd virtual keyboard): 4
DEBUG: src/device.c:121: capabilities of /dev/input/event4 (Synaptics TM3289-002): 3
DEBUG: src/device.c:121: capabilities of /dev/input/event9 (Video Bus): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event3 (AT Translated Set 2 keyboard): 4
DEBUG: src/device.c:121: capabilities of /dev/input/event11 (HDA Intel PCH Headphone): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event12 (HDA Intel PCH HDMI/DP,pcm=3): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event10 (HDA Intel PCH Mic): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event2 (Power Button): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event1 (Lid Switch): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event0 (Sleep Button): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event6 (ThinkPad Extra Buttons): 0
DEBUG: src/device.c:121: capabilities of /dev/input/event5 (TPPS/2 Elan TrackPoint): 1
DEVICE: ignoring 0fac:1ade  (keyd virtual pointer)
DEVICE: ignoring 0002:000a  (TPPS/2 Elan TrackPoint)
DEVICE: ignoring 06cb:0000  (Synaptics TM3289-002)
DEVICE: match    0001:0001  /etc/keyd/default.conf  (AT Translated Set 2 keyboard)
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 157
DEBUG: src/device.c:454: key rightcontrol down
DEBUG: src/daemon.c:429: input rightcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol down
DEBUG: src/device.c:454: key leftcontrol down
DEBUG: src/device.c:459: unrecognized evdev event type: 17 1 1
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 183
DEBUG: src/device.c:454: key sysrq down
DEBUG: src/daemon.c:429: input sysrq down
DEBUG: src/vkbd/uinput.c:324: output sysrq down
DEBUG: src/device.c:454: key sysrq down
^[[57361;5uDEBUG: src/device.c:459: unrecognized evdev event type: 4 4 157
DEBUG: src/device.c:454: key rightcontrol up
DEBUG: src/daemon.c:429: input rightcontrol up
DEBUG: src/keyboard.c:245: Deactivating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol up
DEBUG: src/device.c:454: key leftcontrol up
DEBUG: src/device.c:459: unrecognized evdev event type: 17 1 0
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 183
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 28
DEBUG: src/device.c:454: key enter down
DEBUG: src/daemon.c:429: input enter down
DEBUG: src/vkbd/uinput.c:324: output enter down
DEBUG: src/device.c:454: key enter down
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 28
DEBUG: src/device.c:454: key enter up
DEBUG: src/daemon.c:429: input enter up
DEBUG: src/vkbd/uinput.c:324: output enter up
DEBUG: src/device.c:454: key enter up
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 157
DEBUG: src/device.c:454: key rightcontrol down
DEBUG: src/daemon.c:429: input rightcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol down
DEBUG: src/device.c:454: key leftcontrol down
DEBUG: src/device.c:459: unrecognized evdev event type: 17 1 1
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 183
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 157
DEBUG: src/device.c:454: key rightcontrol up
DEBUG: src/daemon.c:429: input rightcontrol up
DEBUG: src/keyboard.c:245: Deactivating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol up
DEBUG: src/device.c:454: key leftcontrol up
DEBUG: src/device.c:459: unrecognized evdev event type: 17 1 0
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 183
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 28
DEBUG: src/device.c:454: key enter down
DEBUG: src/daemon.c:429: input enter down
DEBUG: src/vkbd/uinput.c:324: output enter down
DEBUG: src/device.c:454: key enter down
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 28
DEBUG: src/device.c:454: key enter up
DEBUG: src/daemon.c:429: input enter up
DEBUG: src/vkbd/uinput.c:324: output enter up
DEBUG: src/device.c:454: key enter up
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 157
DEBUG: src/device.c:454: key rightcontrol down
DEBUG: src/daemon.c:429: input rightcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/vkbd/uinput.c:324: output leftcontrol down
DEBUG: src/device.c:454: key leftcontrol down
DEBUG: src/device.c:459: unrecognized evdev event type: 17 1 1
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 224
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 29
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 183
DEBUG: src/device.c:454: key sysrq up
DEBUG: src/daemon.c:429: input sysrq up
DEBUG: src/vkbd/uinput.c:324: output sysrq up
DEBUG: src/device.c:454: key sysrq up
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 29
DEBUG: src/device.c:454: key leftcontrol down
DEBUG: src/daemon.c:429: input leftcontrol down
DEBUG: src/keyboard.c:260: Activating layer control
DEBUG: src/device.c:459: unrecognized evdev event type: 4 4 46

P.S.: I'm having trouble shutting down the daemon. After one or two shutdowns and restarts, keyd stops finding my laptop's keyboard, forcing me to reboot my computer in order to being able to launch keyd.