Launching apps automatically at startup in Gamemode?

How would I go about setting up an app to launch in the background at startup in gamemode? I’d really like to have qbittorrent launching in game mode and running in the background, I’ve tried systemd but it doesn’t seem to work. Any suggestions? Is it maybe related to being a flatpak app? Cheers!
38 Replies
termdisc
termdisc5mo ago
I’ve tried systemd but it doesn’t seem to work
describe what you did here because that is exactly how you'd get an app to run as a service in game mode
AutismusMaximus
AutismusMaximus5mo ago
Even when it's a flatpack? I followed this guide: https://linuxhandbook.com/create-systemd-services/ Do you recommend me to follow another guide instead?
Linux Handbook
How to create a systemd service in Linux
Learn the steps for creating systemd services in Linux with the practical example demonstrated in this tutorial.
termdisc
termdisc5mo ago
even when it's a flatpak. I have Syncthing working this way to sync saves that aren't on the various clouds
AutismusMaximus
AutismusMaximus5mo ago
Damn, have you got any instructions I can follow? I was really sure I did everything correctly but prolly messed something up
termdisc
termdisc5mo ago
look at Syncthing's .service file https://raw.githubusercontent.com/zocker-160/SyncThingy/master/linux_packaging/syncthingy.service and these are the commands that enable it
mkdir -p ~/.config/systemd/user
wget https://raw.githubusercontent.com/zocker-160/SyncThingy/master/linux_packaging/syncthingy.service -O ~/.config/systemd/user/syncthingy.service
systemctl --user enable --now syncthingy
mkdir -p ~/.config/systemd/user
wget https://raw.githubusercontent.com/zocker-160/SyncThingy/master/linux_packaging/syncthingy.service -O ~/.config/systemd/user/syncthingy.service
systemctl --user enable --now syncthingy
AutismusMaximus
AutismusMaximus5mo ago
I just got home, going to walk my dogs and hop on my bazzite tiny. Thanks already for the info I'll get back to you Do you perhaps have anything I can follow step by step? I probably went wrong somewhere but I've no clue where. I'll copy paste the service I made when I get back home! Thank you so much already, I really can't figure it out on my own.
termdisc
termdisc5mo ago
this is like the command but with more words in between each line https://www.reddit.com/r/SteamDeck/comments/vocyi5/start_syncthing_automatically_on_steamdeck_even/ same concept, different apps
AutismusMaximus
AutismusMaximus5mo ago
Alright I've tried using nano to go into /home/deck/.config/systemd/user/ but it says the folders don't exist? Maybe my issue was placing the service in this folder? "/etc/systemd/system/qbittorrent.service " These are the parameters I used by the way: [Unit] Description=Qbittorrent [Service] ExecStart=/usr/bin/flatpak run org.qbittorrent.qBittorrent ExecStop=/usr/bin/flatpak kill org.qbittorrent.qBittorrent [Install] WantedBy=default.target
termdisc
termdisc5mo ago
that is addressed in the first line in this code block https://discord.com/channels/1072614816579063828/1195329884973703168/1195448698440798258 I would just have it run in user space I don't know what the ExecStop line is for or why you need it
AutismusMaximus
AutismusMaximus5mo ago
Alright so I ran mkdir -p ~/.config/systemd/user but it still says the folder doens't exist?
termdisc
termdisc5mo ago
show me a screenshot of what you ran
AutismusMaximus
AutismusMaximus5mo ago
No description
AutismusMaximus
AutismusMaximus5mo ago
Thank you for having the patience with me by the way, I really want to learn this
termdisc
termdisc5mo ago
what is saying the folder doesn't exist show me whatever is throwing that error
AutismusMaximus
AutismusMaximus5mo ago
nano /home/deck/.config/systemd/user/qbittorrent.service
AutismusMaximus
AutismusMaximus5mo ago
No description
termdisc
termdisc5mo ago
check your user name
AutismusMaximus
AutismusMaximus5mo ago
Alright so I tried running all of the commands again, but instead using my username instead of "user" and I've still got the same issue I'm probably missing something here
AutismusMaximus
AutismusMaximus5mo ago
No description
AutismusMaximus
AutismusMaximus5mo ago
This is true though, I can't see any of these folders in the dolphin file explorer I don't have a deck folder at all mkdir: cannot create directory ‘/home/deck/.config/systemd/user/’: No such file or directory Have I used a wrong image of bazzite or something? Did I not select systemd but something else whilst installing? I've no clue why this isn't working. What you've linked and told me so far I've tried myself but I thought I was doing something wrong. I'm using bazzite deck.
termdisc
termdisc5mo ago
check your user name your user name is here
AutismusMaximus
AutismusMaximus5mo ago
I don't understand
termdisc
termdisc5mo ago
you are entering nano /home/deck/... did you name your user deck?
AutismusMaximus
AutismusMaximus5mo ago
How can I check what username is for game mode? For desktop mode its autismusmaximus
termdisc
termdisc5mo ago
the very first thing here is your user name the linux home folder is at /home/USERNAME_HERE/
AutismusMaximus
AutismusMaximus5mo ago
No description
termdisc
termdisc5mo ago
you are trying to create a folder at /home/deck/.... you do not have a user named deck on your system
AutismusMaximus
AutismusMaximus5mo ago
There's no deck folder here? Oh wow Damn jesus fuck I'm an idiot Alright so I finally was able to make the service in the right location How would I go about activating it? "Failed to enable unit: Unit file qbitorrent.service does not exist. " When I try " systemctl --user enable qbitorrent.service " I made the file alright, It's in the folder it's supposed to be But I'm not able to enable the service Previously I was able to enable it but am I missing something here? Ugh it keeps giving me " Failed to enable unit: Unit file qbittorrent.service does not exist. "
AutismusMaximus
AutismusMaximus5mo ago
No description
AutismusMaximus
AutismusMaximus5mo ago
Yeah, it's still not working. I've got the service in right folder but I'm not able to activate it apparently. I've tried using the absolute address /home/autismusmaximus/.config/systemd/autismusmaximus/qbittorent.service and it will say the system has linked but it's actually not working in game mode Do I need to reinstall my OS or something? I've no clue and I'm getting really frustrated with this When I enablle it, it makes the system link but when I try and start it, it tells me "Failed to start home-autismusmaximus-.config-systemd-autismusmaximus-qbittorrent.service.mount: Unit home-autismusmaximus-.config-systemd-autismusmaximus-qbittorrent.service.mount not found."
termdisc
termdisc5mo ago
Don’t do sudo here. You’ve locked the file permissions that way And the actual word “user” in the path should’ve stayed user
AutismusMaximus
AutismusMaximus5mo ago
When I try writing without sudo it throws me permission denied
termdisc
termdisc5mo ago
Either change the permissions to the file or don’t use sudo You do not want a root owned file there
AutismusMaximus
AutismusMaximus5mo ago
I removed the original file Then I made a new one without sudo Started the service, seems to be working in desktop mode Still nothing in game mode, my webui android app doens't connect with it at all I've learned a lot at this point to be honest, thanks for that! But I think I'm going to give up, this simply isn't working under steamOS IMO I've got my webUI setup under qbittorrent and it works perfectly fine when in desktop mode, but it won't connect in game mode even after all of this hassle. If you got any other tip, I'll be glad to follow it but right now all of this seems to have been a waste of time. Is it possible the service only launches in desktop mode? What did I do wrong? Everything seems to be in order at this point. At least in desktop mode it is, whenever I launch game mode it simply doesn't launch the application, is there any way for me to check this inside of game mode? I really want to get this working When running qbitorrent inside of steam in game mode itself everything works perfect But I would like to have qbittorrent running in the background at all times so I can access the webui at all times Mainly because I got kodi installed as well and I want to download from my home pc... Well, if you got any ideas it would be nice to hear but at this point nothing is working
termdisc
termdisc5mo ago
You’ll likely need to verify that your service is launched by logging in via an ssh terminal I’m also not saying to blindly copy, but look at all of the various flags and arguments used by the syncthing service and see what ones are usable by qb
AutismusMaximus
AutismusMaximus5mo ago
I ssh'd into it and it's not running whilst in game mode. I've tried removing and recreating the service multiple times but it only automatically starts in desktop mode. However in game mode it doesn't for some weird reason Wow I finally figured it out!! Thanks so much for all of these tips, I know much more now :)
termdisc
termdisc5mo ago
What did you do?
©TriMoon™
©TriMoon™5mo ago
That location is for running system services. You app needs a GUI, which is only available in a user session, thus you can't use system services to launch GUI apps 😉