Set static per-key colors on the built-in keyboard of a Dell G16 7620 from Linux. The utility reads one complete color map from the user's XDG config directory and applies it atomically.
The tool supports only the Darfon keyboard with USB ID 0d62:dcbc. It verifies
the keyboard's HID descriptor before writing and refuses other devices.
- Linux with
hidrawsupport - A C++20 compiler
- CMake 3.20 or newer
- Ninja
- udev with logind for unprivileged access
- systemd for optional automatic startup
If lsusb is available, you can check the keyboard's USB ID before building:
lsusb -d 0d62:dcbcNo output means this utility does not support the detected keyboard. A matching USB ID is necessary but not sufficient; the utility performs an additional HID descriptor check before applying a color.
- Dell G16 7620 with the
0d62:dcbcDarfon keyboard - Manjaro Linux with kernel
6.1.177-3-MANJARO
Build, test, and install the utility for the current user:
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$HOME/.local"
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install buildThis installs the executable to ~/.local/bin, generates a user service in
~/.local/share/systemd/user, and creates the initial color map at
~/.config/dell-g16-keyboard-rgb/colors.conf. Reinstalling preserves an
existing color map.
Review and install the narrowly scoped udev rule:
sudo install -o root -g root -m 0644 \
udev/70-dell-g16-keyboard-rgb.rules \
/etc/udev/rules.d/70-dell-g16-keyboard-rgb.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --action=change --subsystem-match=hidrawThe utility should then run as the active desktop user. Do not run it with
sudo. The uaccess rule may not grant access to an SSH-only session.
Edit ~/.config/dell-g16-keyboard-rgb/colors.conf to customize the keyboard.
Each key has a six-digit RGB color:
esc=ff5500
f1=c0ffff
h=ff5500The installed map lists every supported key in keyboard order. The utility rejects missing, duplicate, unknown, or malformed entries instead of applying a partial layout.
Preview the complete map without opening the keyboard:
~/.local/bin/dell-g16-keyboard-rgbApply it:
~/.local/bin/dell-g16-keyboard-rgb --applyUse --config PATH to read the same format from another location. Run
~/.local/bin/dell-g16-keyboard-rgb --help for the complete command shape.
The installed user service reads and applies the color map once when the user session starts. It does not leave a daemon running.
systemctl --user daemon-reload
systemctl --user enable --now dell-g16-keyboard-rgb.serviceAfter editing the color map, apply it immediately with the utility or restart the service:
systemctl --user restart dell-g16-keyboard-rgb.serviceThe keyboard firmware may replace the color after reboot or suspend. The user service handles a new login, but it does not currently reapply colors after resume from suspend.
If the utility cannot access the keyboard, confirm that lsusb -d 0d62:dcbc
finds it, reinstall or retrigger the udev rule, and run the command from an
active desktop session. The utility also accepts --device /dev/hidrawN for
diagnosis, but still performs every identity check.
If keyboard input ever stops, let the command exit first. If input does not
recover, reboot using another input path. Reloading usbhid can also recover
it, but a reboot is simpler and avoids disrupting every other USB HID device.
systemctl --user disable --now dell-g16-keyboard-rgb.service
rm -f "$HOME/.local/share/systemd/user/dell-g16-keyboard-rgb.service"
rm -f "$HOME/.local/bin/dell-g16-keyboard-rgb"
systemctl --user daemon-reload
sudo rm -f /etc/udev/rules.d/70-dell-g16-keyboard-rgb.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --action=change --subsystem-match=hidrawThe color map is left in place so an uninstall does not discard customization.
- Without
--apply, the utility only prints the exact reports it would send and does not open/dev/hidraw*. - Before writing, it verifies both USB IDs and the HID descriptor sequence for
report ID
0xccwith its 63-byte payload. - It sends only five fixed API-v5 operations: begin transaction (
94), status (93), static color (8c 02), end color data (8c 13), and apply (8b 01 ff). The transaction-begin command is a lighting-protocol reset, not a USB, firmware, or machine reset. - Key IDs come from a compiled allowlist. There is no raw command option.
- The color map must define every allowlisted key exactly once.
- The project has no third-party runtime libraries, network code, fan or power controls, firmware persistence commands, or automatic root escalation.
The protocol tests and dry-run CLI tests do not require keyboard access. To also make compiler warnings fail the build:
cmake -S . -B build -G Ninja \
-DDELL_G16_KEYBOARD_RGB_WARNINGS_AS_ERRORS=ON
cmake --build build
ctest --test-dir build --output-on-failure