You are not logged in.
I wrote a systemd configuration that I want to run prior to suspend to turn off lighting in my system.
[Unit]
Description=Set OpenRGB Lighting with Off Profile
Before=suspend.target
[Service]
User=nn
Type=oneshot
ExecStart=/usr/bin/openrgb -p off.orp
TimeoutSec=0
[Install]
WantedBy=suspend.target
I can manually run it - systemctl start openrgb_off.service and it'll turn off the lighting, but when suspending my system, the lighting does not go off.
Oddly, when I do resume from suspend, the lighting will turn off leading me to believe it's actually running after resuming.
Last edited by ndttt (2022-09-30 04:53:15)
Offline
I am not using OpenRGB, but upon having a look it seems it’s running as a daemon+client. Which would mean your invocation of “/usr/bin/openrgb” merely sends a request to the daemon and instantly returns without waiting for the daemon to actually apply changes.
Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
I am not using OpenRGB, but upon having a look it seems it’s running as a daemon+client. Which would mean your invocation of “/usr/bin/openrgb” merely sends a request to the daemon and instantly returns without waiting for the daemon to actually apply changes.
So because it sends a request to the daemon and doesn't actually wait for it to finish (when I run it manually, it isn't instantaneous, I do notice it takes a few seconds to actually turn off the RGB.) but the system suspends before it can complete?
Would there be a way to ensure the request can be completed prior to suspending ?
Offline
"ensure" not, unless openrgb has a synchronous mode (ie wait for response from the daemon) but you coud "ExecStartPost=sleep 3" to have the service wait 3 seconds.
Offline
but the system suspends before it can complete?
This is my hypothesis.
Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
"ensure" not, unless openrgb has a synchronous mode (ie wait for response from the daemon) but you coud "ExecStartPost=sleep 3" to have the service wait 3 seconds.
This did the trick!
My system reliably shuts down the lights when suspending, thanks !
This is my hypothesis.
Looks like you were right. I appreciate the help, it led me to the solution!
Offline
You can probably shorten the timeout, 1 second might be enough (sleep also does miliseconds, but the lower you got the less reliable it becomes)
Offline