cc890824bddfaf1ee5ce207523c2c22d3242d894
direct-mode color apply aborts (vector OOB → SIGABRT) on ASUS Aura devices that expose addressable zones with zero LEDs; switch to static mode, which applies the same color across all devices/zones without hitting that path. Also connect to the running OpenRGB SDK server via --client host:port instead of re-detecting all hardware on every toggle. This wires up the previously-unused openrgb.host/port config fields and removes a full USB/HID re-scan per command — that re-scan racing the server is what made it flakiest at login/boot. The existing retry logic now serves its intended purpose (waiting for the server to come up if the daemon starts first) rather than re-running a guaranteed-crashing command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
led-controller
A daemon that automatically turns RGB LEDs on and off based on display state. When your monitor sleeps or you lock your screen, LEDs turn off. When you wake or unlock, they turn back on.
Controls two types of lights:
- Computer RGB via OpenRGB CLI (motherboard, RAM, GPU, peripherals)
- External LEDs via CH341 USB serial relay (LED strips, desk lights, etc.)
Requirements
- Linux with D-Bus (GNOME, KDE, XFCE, etc.)
- Go 1.21+
- OpenRGB installed (for PC RGB control)
- CH341 USB relay module on
/dev/ttyUSB0(for external LED control)
Build & Install
make build
make install # binary + config to ~/.config/led-controller/
make install-service # enable systemd user service
Usage
Daemon (automatic)
# Start via systemd
systemctl --user start led-controller
# Or run directly
./led-controller daemon
The daemon turns LEDs on at startup, then listens for D-Bus signals to toggle them:
- Screen lock/blank → LEDs off
- Screen unlock/unblank → LEDs on
- System suspend → LEDs off
- System wake → LEDs on
Manual toggle
./led-controller on
./led-controller off
Configuration
Config file: ~/.config/led-controller/config.toml
[openrgb]
enabled = true
[relay]
enabled = true
device = "/dev/ttyUSB0"
baud = 9600
channel = 1
[monitor]
# "screensaver" - screen lock/blank events only
# "logind" - system suspend/resume only
# "all" - both (default)
method = "all"
Permissions
The USB relay device requires read/write access. Add your user to the dialout group:
sudo usermod -aG dialout $USER
Log out and back in for the group change to take effect.
Architecture
main.go Daemon entry point, signal handling, event loop
config/ TOML config loader
monitor/ D-Bus listener (screensaver + logind signals)
controller/
controller.go Orchestrates OpenRGB + relay
openrgb/ OpenRGB CLI wrapper
relay/ CH341 serial relay protocol (0xA0 command format)
Description
Languages
Go
95.5%
Makefile
4.5%