Waybar: Keyboard-state module not detecting capslock status correctly
I’m using a moonlander. Waybar does not seem to be detecting the capslock state correctly. Starting waybar with my user as a member of the input group and the keyboard-state module enabled yields:
But, the capslock state in the bar behaves a bit weirdly:
- On bar start it’s correct (shows the unlocked icon when capslock is off)
- When pressing capslock it responds correctly as well (shows the lock icon when capslock is on)
- But after that it no longer responds to capslock changes. So it keeps showing the lock icon, no matter if capslock is on or off (i.e. it no longer responds to the actual capslock state).
The following script (as a custom module, based on the suggestion here: https://github.com/swaywm/sway/issues/4512#issuecomment-526898845) does work correctly:
#!/bin/bash
capslock=$(cat /sys/class/leds/input17::capslock/brightness)
if [[ "${capslock}" == "1" ]]; then
echo ''
echo ''
echo "locked"
exit 0
fi
echo ''
echo ''
echo "unlocked"
This is the (truncated) output of swaymsg -t get_inputs
:
[...]
Input device: ZSA Technology Labs Moonlander Mark I Keyboard
Type: Keyboard
Identifier: 12951:6505:ZSA_Technology_Labs_Moonlander_Mark_I_Keyboard
Product ID: 6505
Vendor ID: 12951
Active Keyboard Layout: English (US)
Libinput Send Events: enabled
Input device: ZSA Technology Labs Moonlander Mark I Consumer Control
Type: Mouse
Identifier: 12951:6505:ZSA_Technology_Labs_Moonlander_Mark_I_Consumer_Control
Product ID: 6505
Vendor ID: 12951
Libinput Send Events: enabled
Input device: ZSA Technology Labs Moonlander Mark I Consumer Control
Type: Keyboard
Identifier: 12951:6505:ZSA_Technology_Labs_Moonlander_Mark_I_Consumer_Control
Product ID: 6505
Vendor ID: 12951
Active Keyboard Layout: English (US)
Libinput Send Events: enabled
Input device: ZSA Technology Labs Moonlander Mark I System Control
Type: Keyboard
Identifier: 12951:6505:ZSA_Technology_Labs_Moonlander_Mark_I_System_Control
Product ID: 6505
Vendor ID: 12951
Active Keyboard Layout: English (US)
Libinput Send Events: enabled
Input device: ZSA Technology Labs Moonlander Mark I
Type: Keyboard
Identifier: 12951:6505:ZSA_Technology_Labs_Moonlander_Mark_I
Product ID: 6505
Vendor ID: 12951
Active Keyboard Layout: English (US)
Libinput Send Events: enabled
[...]
As you see the moonlander is in there multiple times. I wonder if waybar is just listening to the wrong device. And if so, can we specify in the config what device it should listen to? It doesn’t seem like it from the docs.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 17 (5 by maintainers)
I am facing the same issue, but I am using https://github.com/k0kubun/xremap to remap certain keys. However, no function is assigned to the caps lock key.
Without xremap (it works):
With xremap (doesn’t):