qmk-light is a CLI utility that reads and sets keyboard backlight brightness
on VIA-compatible QMK devices over HID.
Code in this repo is still experimental and it might not be complete, use on your own risk!
Install from AUR.
paru -S qmk-light-binDownload the matching package from the latest GitHub release:
qmk-light_<version>_amd64.debqmk-light_<version>_arm64.deb
Then install it:
sudo dpkg -i qmk-light_<version>_<arch>.debIf dpkg reports missing dependencies, run:
sudo apt-get install -fInstall build/runtime dependencies:
sudo apt-get update
sudo apt-get install -y g++ libhidapi-devCompile:
g++ -std=c++17 -O2 qmk-light.cpp -lhidapi-hidraw -o qmk-lightOptional install:
sudo install -m 0755 qmk-light /usr/local/bin/qmk-lightList compatible devices:
qmk-light --listRead brightness (uses the first compatible device by default):
qmk-light --get-brightnessRead brightness for a specific device index or path:
qmk-light --device 0 --get-brightness
qmk-light --device "/dev/hidraw3" --get-brightnessSet brightness:
qmk-light --set-brightness 75
qmk-light --set-brightness +5
qmk-light --set-brightness -10List standard RGB effect modes:
qmk-light --list-effectsGet current effect ID:
qmk-light --get-effectSet effect ID (0-255):
qmk-light --set-effect 12Get current effect speed:
qmk-light --get-effect-speedSet effect speed (0-255):
qmk-light --set-effect-speed 128Get current color (Hue, Saturation):
qmk-light --get-colorSet color (Hue 0-255, Saturation 0-255):
qmk-light --set-color 128,255Use the first compatible device explicitly (same selection as default behavior):
qmk-light --first-device --set-brightness 50Run quietly (suppress error messages; useful for scripts):
qmk-light --quiet --get-brightness
qmk-light -q --device 0 --set-brightness 50Show help:
qmk-light --helpIf you encounter the error Selected device does not expose a supported brightness channel or if the CLI only works when run with sudo, it is likely a permissions issue with your udev rules. Your user needs read/write access to the /dev/hidraw* device node.
-
Install standard QMK rules: Many distributions provide a
qmkpackage orqmk-udev-rulespackage that includes rules for most standard QMK/VIA keyboards. Try installing that first and reloading your udev rules. -
Create a custom udev rule: If your keyboard is a vendor fork or not in the official QMK database, you will need to create a custom rule.
First, find your keyboard's Vendor ID (vid) and Product ID (pid) by running:
qmk-light --list
Note: If the list is empty, try running
sudo qmk-light --list.Create a new file at
/etc/udev/rules.d/50-qmk-light.ruleswith the following content, replacingXXXXandYYYYwith your actual vid and pid:KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="YYYY", MODE="0660", TAG+="uaccess" -
Apply the rules: Reload the udev rules and force them to apply:
sudo udevadm control --reload-rules sudo udevadm trigger --subsystem-match=hidraw --action=add
(Alternatively, you can just unplug and replug your keyboard).
Rebuild and run a quick check:
g++ -std=c++17 -O2 qmk-light.cpp -lhidapi-hidraw -o qmk-light
./qmk-light --listThis repository includes a GitHub Actions workflow that:
- Builds Linux binaries for
amd64andarm64 - Packages
.debfiles for both architectures - Uploads all artifacts to a GitHub release
To publish a release:
- Create and push a tag like
v1.2.3 - Wait for the
Build and Releaseworkflow to complete - Download binaries and
.debpackages from the release assets
Example:
git tag v1.2.3
git push origin v1.2.3- AI was used to write up the code.