You are not logged in.
Hello, I'm looking for a way to modify the led brightness value for an arbitrary key (space bar) using the shell.
So far I know that I can find all the usual toggleable keys (num lock, caps lock, etc) in /sys/class/leds, and that I can for example modify the brightness value of my caps lock key like this:
echo 1 | sudo tee /sys/class/leds/input8::capslock/brightnessBut I want to perform this with the "space" key which is not in /sys/class/leds
So I tried the xet utility command and its different combinations:
xet led
xet led on
xet +led <number>but none of them worked.
So tbh I'm kind of lost here.
The reason I want to do this is because I'm making a script that toggles a remap for the space key:
- when this script is executed for the first time the space key will be remapped to Control_L
- and if I run the script again then the space key will be remapped back to "space".
I want to turn on the led for the space key when the script is executed the first time (and consequently space is map to Control_L) and turn it off when I execute it a second time (when space is remap to its original value) and so on...
Offline
So far I know that I can find all the usual toggleable keys (num lock, caps lock, etc) in /sys/class/leds
But I want to perform this with the "space" key which is not in /sys/class/leds
/sys/class/leds/ devices are registered by keyboard USB HID driver. HID specification lists following keyboard indicators: Num Lock, Caps Lock, Scroll Lock, Compose, Kana, Shift. There is no "space" led.
If your keyboard has non-standard leds and provides interface to control them, the driver you are using should be aware of those leds.
What keyboard model is it?
$ udevadm info /sys/class/input/input8$ ls -d1 /sys/class/input/input8/input*Last edited by dimich (2025-02-03 07:09:10)
Offline
/sys/class/leds/ devices are registered by keyboard USB HID driver. HID specification lists following keyboard indicators: Num Lock, Caps Lock, Scroll Lock, Compose, Kana, Shift. There is no "space" led.
If your keyboard has non-standard leds and provides interface to control them, the driver you are using should be aware of those leds.What keyboard model is it?
My keyboard is a Keychron K2 Pro, which is compatible with via, these are the outputs for the commands:
udevadm info /sys/class/input/input8
P: /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/0003:3434:0220.0003/input/input8
M: input8
R: 8
J: +input:input8
U: input
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/0003:3434:0220.0003/input/input8
E: SUBSYSTEM=input
E: PRODUCT=3/3434/220/111
E: NAME="Keychron Keychron K2 Pro Keyboard"
E: PHYS="usb-0000:00:14.0-2/input2"
E: UNIQ=""
E: PROP=0
E: EV=120013
E: KEY=1000000000007 ff98007a000007ff febeffdfffefffff fffffffffffffffe
E: MSC=10
E: LED=1f
E: MODALIAS=input:b0003v3434p0220e0111-e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,A1,A3,A4,A5,A6,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,3,4,sfw
E: USEC_INITIALIZED=3242811
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_BUS=usb
E: ID_MODEL=Keychron_K2_Pro
E: ID_MODEL_ENC=Keychron\x20K2\x20Pro
E: ID_MODEL_ID=0220
E: ID_SERIAL=Keychron_Keychron_K2_Pro
E: ID_VENDOR=Keychron
E: ID_VENDOR_ENC=Keychron
E: ID_VENDOR_ID=3434
E: ID_REVISION=0100
E: ID_TYPE=hid
E: ID_USB_MODEL=Keychron_K2_Pro
E: ID_USB_MODEL_ENC=Keychron\x20K2\x20Pro
E: ID_USB_MODEL_ID=0220
E: ID_USB_SERIAL=Keychron_Keychron_K2_Pro
E: ID_USB_VENDOR=Keychron
E: ID_USB_VENDOR_ENC=Keychron
E: ID_USB_VENDOR_ID=3434
E: ID_USB_REVISION=0100
E: ID_USB_TYPE=hid
E: ID_USB_INTERFACES=:030101:030000:
E: ID_USB_INTERFACE_NUM=02
E: ID_USB_DRIVER=usbhid
E: ID_PATH_WITH_USB_REVISION=pci-0000:00:14.0-usbv2-0:2:1.2
E: ID_PATH=pci-0000:00:14.0-usb-0:2:1.2
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_2
E: ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_2_1_2
E: TAGS=:seat:
E: CURRENT_TAGS=:seat:ls -d1 /sys/class/input/input8/input*
/sys/class/input/input8/input8::capslock
/sys/class/input/input8/input8::compose
/sys/class/input/input8/input8::kana
/sys/class/input/input8/input8::numlock
/sys/class/input/input8/input8::scrolllockOffline
My keyboard is a Keychron K2 Pro, which is compatible with via
It doesn't seem to provide standard Linux led interface for extra leds. There is vial-appimage package in AUR. However, i don't know whether it provides command line tool for led control.
Is the keyboard compatible with QMK? If yes, did you try qmk?
Offline
Is the keyboard compatible with QMK? If yes, did you try qmk?
It is, but I'd didn't use it before. The documentation shows there are functions to control the rgb behavior but it seems those functions are meant to be used in the configuration which is written in C.
I don't know to which extend I can use them to recognize when a keycode has certain value (sapce or Control_L) assigned to it, but it seems a good start.
Offline