OpenRGB Autostart in Gamescope Session?
I just recently rebased to a deck image. Previous setup with openrgb autostart on KDE desktop with no issues and it still works when I exit to desktop mode.
However I can’t seem to get a service working to have it run with gamemode.
Has anyone else managed to get this working?
My install of OpenRGB is an app image installed by the ujust command.
1 Reply
So I just figured out how to do this.
1) Install OpenRGB with the ujust install-openrgb command. This will setup the udev rules automatically. If you install the flatpak it probably would also work but when I tried that despite having the rules installed it would keep telling me that I didn't and I think it was causing my service to fail
2) Use gearlever to move the app to your app menu, I don't remember the exact option, but it will move it to a directory. For me it was /home/username/AppImages/
3) Run OpenRGB and setup everything the way you want, create and save a profile. Don't set up autostart at login, that won't be needed with this method
4) Create a script that runs openrgb without the GUI but applies your profile. If you try to run it with the GUI through the service it fails with exit code 134. That's done with the argument -c 080808
for example create a file that is profile.sh with the following contents:
/home/username/AppImages/openrgb.appimage -c 080808 -p profilename
5) Make sure the script file is marked as executable
6) Move the file to somewhere outside of home. I created a directoy under /usr/local/bin/OpenRGB to house my script. You will need to use a sudo mv command to do this. The reason for this is if you have the scipt file on a home directory SELinux will refuse to let your service execute the script
6.1) if you don't care about having SELinux enforce its security measures then you can use sudo setenforce 0 to disable enforcement and having the script in a home directory is probably fine
7) Create a openrgb.service file under etc/systemd/system, you can either do this with sudo nano /etc/systemd/system/openrgb.service, or create the service file elsehwere and move it into that directory with sudo mv. If you use sudo mv there is a risk that the permissions and ownerships will be a propblem but usually can be resolved with chown and chmod.
The contents of your service file should look like something like this:
[Unit]
Description=OpenRGB Service
After=network-online.target
[Service]
Environment=HOME=/var/home/username
Type=oneshot
ExecStart=/usr/local/bin/OpenRGB/profile.sh
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
the Environment specified was necessary in this case I believe to have the working directory of the OpenRGB binary be exposed to systemd. I would otherwise run into a 203 exit code. you might not have to use this if SELinux is set to not enforce. The Type=oneshot means that it will excute, set the profile, then exit when it is successful.
8) run sudo systemctl daemon-reload
9) run sudo systemctl enable openrgb.service if it fails with a 203 it means something up with SELinux but double check your directories. If it doesnt say anything then run sudo systemctl status openrgb.service, if there is an exit code 134 there then double check your launch arguments under profile.sh
10) if you've double checked everything try enabling and starting the service again after you run sudo setenforce 0, if the service then enbales and starts successfully (check with systemctl status) then the file context for your profile.sh which labels it incorrectly for SELinux preventing its execution. You can either just use the service with setenforce 0, but if you want to have it at setenforce 1 you'll have to adjust the file context which is what I ended up having to do
10.1) sudo semanage fcontext -a -t -bin_t "/usr/local/bin/OpenRGB/profile.sh"
10.2 sudo restorecon -v /usr/local/bin/OpenRGB/profile.sh