I’m at a loss how best to handle turning off and on my LEDs when locking or unlocking in KDE using OpenRGB. There used to be a way to do this a long time ago, but was removed at some point and the functionality was never re-added. BUG 481069
I already know how to manually handle the LEDs:
openrgb --server -d 3 -b 100
this changes the led brightness to 100 or 0 respectively, this works fast. I already have OpenRGB running in server mode on first login.
I also already found a reliable source from dbus for when the screen is either locked or unlocked:
❯ dbus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" |grep -A1 ActiveChanged
signal time=1739284561.792726 sender=:1.10 -> destination=(null destination) serial=7266 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=ActiveChanged boolean true
signal time=1739284561.792726 sender=:1.10 -> destination=(null destination) serial=7266 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=ActiveChanged boolean true
ActiveChanged will be set “true” when locked, and “false” when unlocked.
I’m not sure how to handle the actual events though. Is there a way to run a systemd service trigger on dbus events? Or is writing a simple bash script that monitors for the events and running the openrgb commands the better way to go?