Is keyboard-state compatible with ZMK powered keyboards?
I am running the latest waybar. I have the following in my config.
"keyboard-state": {
"device-path": "/dev/input/event8",
//"numlock": true,
"capslock": true,
"format": {
"numlock": "N {icon}",
"capslock": " {icon}",
},
"format-icons": {
"locked": "",
"unlocked": ""
},
},
Event8 is active, and i can run a evtest and see when capslock is pressed. Its just waybar says it can't find a device at event8. I can change this to event3, and it detects and reads my MX Masters 3 mouse, I can also plug in any other keyboard and it properly reads the caps lock in the waybar.
I think its a compatibility issue? idk.
I did add my user to the group. So it shouldnt be a permissions issue, especially since waybar can accurately detect other devices.
event8 is the zmk keyboard on this boot, it changes everyboot, that device-path line was just added for debugging purposes.
have you solved this? ive the same problem with my split zmk too
I wrote a script and made it a custom module.
script
#!/bin/bash
caps_lock_state=false
state_file=/tmp/caps_lock_state.txt
evtest /dev/input/by-id/usb-ZMK_Project_Cyboard_64473BEE7CA8FBD7-event-kbd | while read -r line; do
if echo "$line" | grep -q "EV_KEY.*KEY_CAPSLOCK"; then
if echo "$line" | grep -q "value 1"; then
if $caps_lock_state; then
caps_lock_state=false
echo "" > "$state_file"
notify-send "Caps Lock OFF"
else
caps_lock_state=true
echo "" > "$state_file"
notify-send "Caps Lock ON"
fi
fi
fi
done
Then I made use of this custom module.
"custom/capslock": {
"exec": "cat /tmp/caps_lock_state.txt",
"format": "<span color=\"#f53c3c\">{}</span>",
"interval": 1
},
It's pretty self-explanatory, but the script assumes that the caps lock is off at the computer's start. Whenever the caps lock is pressed, it changes the contents of a temp file, which is displayed in the swaybar. The file gets deleted on every boot.
edit: I would imagine the name of your zmk keyboard will be different from mine, so you would need to change that. You will likely find it in /dev/input/by-id/
I have a zmk keyboard and keyboard-state works out of box for me.