Skip to content

Commit beac7ca

Browse files
committed
Merge branch 'main' of https://github.com/JustTemmie/steam-presence into main
2 parents ee9fdc0 + e5ec614 commit beac7ca

File tree

2 files changed

+155
-1
lines changed

2 files changed

+155
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,15 @@ if you're running either Windows or MacOS i cannot really give you any help with
193193

194194
(if you do know a way to run this on startup on any of the mentioned systems, please create a pull request with an updated readme)
195195

196-
however if you're running linux i do have a way to start the script on bootup.
196+
## Steam Deck / Linux with Systemd
197+
198+
If you have a Steam Deck, it is possible to have steam-presence start automatically when your Steam Deck boots. This method may also work on other Linux distributions that use per-used Systemd instances. If you (as a regular user) can run the command `systemctl --user status` successfully, then this should work.
199+
200+
The file `steam-presence.service` has more information and instructions.
201+
202+
## Linux (not using Systemd)
203+
204+
If you're running linux i do have a way to start the script on bootup.
197205

198206
create a file named `startup.sh` and paste in the code below, changing the path so it finds the main.py file.
199207

steam-presence.service

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# This is a Systemd service file for steam-presence!
2+
# Using this, you can have steam-presence automatically start on Steam Deck,
3+
# even if you're using the Steam Deck in Gaming mode.
4+
5+
# Systemd is a "system manager". After the low-level OS starts up, Systemd is
6+
# responsible for running the programs that do things like connect you to the
7+
# network, start Bluetooth, and launch Steam. It's also possible to have
8+
# Systemd handle other things, like automatically launching steam-presence!
9+
10+
# This file contains the information that Systemd needs to know how to
11+
# launch steam-presence. HOWEVER, Systemd is not smart enough to automatically
12+
# configure steam-presence. So, before you can use this, you have to get
13+
# steam-presence working first.
14+
15+
# WARNING: This is for advanced users only! We can't really help you if things
16+
# go weird, because it is really hard to provide remote support. Happily, none
17+
# of the things done here will modify the OS, so you're not going to damage your
18+
# Deck.
19+
20+
# Here is what to do. Remember, get Part 1 working before going to Part 2, etc.
21+
#
22+
# PART 1: Get and configure Discord
23+
# * On your Deck, go to Desktop mode.
24+
# * Launch the Discover app, search for, and install Discord.
25+
# * Launch Discord, and sign in. Leave Discord running in the background.
26+
# * In the bottom-right of the screen, you'll see an icon for Steam. Right-
27+
# click it, and select "Library".
28+
# * Add a non-Steam game to your Library, and select Discord from the list of
29+
# things you can add. You'll now see Discord as a 'game'. There won't be
30+
# any logo in the Steam library, but that's OK.
31+
# * Minimize both Discord and Steam. Don't exit them, just minimize them.
32+
#
33+
# PART 2: Get and configure steam-presence
34+
# * Launch the Konsole app to get a terminal.
35+
# * You'll be in your home directory. Clone steam-presence from GitHub:
36+
# > git clone https://github.com/JustTemmie/steam-presence.git
37+
# * Go into the recently downloaded directory
38+
# > cd steam-presence
39+
# * Turn this Git clone into a Python venv:
40+
# > python3.10 -m venv .
41+
# * Update the venv and install steam-presence required software
42+
# > ./bin/python -m pip install --upgrade pip wheel
43+
# > ./bin/python -m pip install -r requirements.txt
44+
# * Copy exampleconfig.json to config.json and edit it, as per the README.
45+
# * Run steam-presence.
46+
# > ./bin/python ./main.py
47+
# If everything is configured correctly, you should eventually be told
48+
# "Everything is ready".
49+
# Press Control-C to exit steam-presence.
50+
#
51+
# PART 3: Enable auto-start
52+
# * In the Konsole (the terminal), copy this file to the place where Systemd
53+
# looks for service files:
54+
# > cp steam-presence.service ~/.config/systemd/user/steam-presence.service
55+
# * Reload Systemd, so that is becomes aware of steam-presence:
56+
# > systemctl --user daemon-reload
57+
# * Enable steam-presence, so that it will start automatically when the Steam
58+
# Deck is restarted:
59+
# > systemctl --user enable steam-presence
60+
# * Tell Systemd to start steam-presence:
61+
# > systemctl --user start steam-presence
62+
# * Check on the status of steam-presence, to see if it started OK:
63+
# > systemctl --user status steam-presence
64+
# Systemd should tell you that steam-presence is running, and at the end
65+
# of the output, you should see the "everything is ready" message.
66+
# If the text goes off the right side of the screen, make the Konsole window
67+
# larger and run the command again.
68+
#
69+
# PART 4: Test!
70+
# * Exit the terminal sesson:
71+
# > exit
72+
# * On the Desktop, double-click the icon to "Return to Gaming Mode".
73+
# * Once in gaming mode, restart the Steam Deck.
74+
# * Once Steam Deck is rebooted, go to the Library, and launch Discord.
75+
# * Once Discord is running, press the STEAM button, go to the Library,
76+
# and lanch an actual game.
77+
# NOTE: It's important that you leave Discord running! steam-presence
78+
# uses Discord (which runs in the background) to relay status updates.
79+
# * Wait about a minute, and then go to Discord on another device (like your
80+
# phone). You should see that Discord is now showing the game you are
81+
# playing!
82+
83+
# Hopefully all of that worked! Just remember:
84+
# * steam-presence will run in the background any time the Deck starts.
85+
# If you want to reduce battery, you can disable it by going to Desktop mode,
86+
# launching the Konsole app, and running these two commands:
87+
# > systemctl --user stop steam-presence
88+
# > systemctl --user disable steam-presence
89+
# That will stop steam-presence, *and* keep it from starting again.
90+
#
91+
# * steam-presence needs Discord running in the background.
92+
#
93+
# * Always launch Discord *before* you launch a game. That gives
94+
# steam-presence time to wake up; also, when you've got multiple "games"
95+
# running, Steam only says that you're "playing" the most recently-launched
96+
# game. So, if you launch Discord second, then Steam will tell everyone
97+
# that you are "playing Discord".
98+
99+
# Good luck!
100+
# The rest of this file is the actual contents of the Systemd service file.
101+
102+
[Unit]
103+
# This is just basic information about what steam-presence is.
104+
Description=Discord rich presence from Steam on Linux
105+
Documentation=https://github.com/JustTemmie/steam-presence
106+
107+
[Service]
108+
# CHANGEME: This is the full command that is run to launch steam-presence.
109+
# If you installed steam-presence somewhere else, then you need to change this.
110+
ExecStart=/home/deck/steam-presence/bin/python -u /home/deck/steam-presence/main.py
111+
112+
# This tells Systemd that steam-presence is a simple service:
113+
# When launched, the Python process stays running until the service exits.
114+
Type=simple
115+
116+
# This tells the OS to treat steam-presence as a lowest-priority program.
117+
Nice=19
118+
119+
# When steam-presence is told to exit, it throws a KeyboardInterrupt Python
120+
# exception. This tells Systemd that it's OK, and that should count as a
121+
# normal program exit.
122+
SuccessExitStatus=130
123+
124+
# This locks down what steam-presence is able to do. It is not able to
125+
# get any more privileges than it already has, and almost the entire
126+
# filesystem is made read-only to it. The only thing made read/write is
127+
# the directory where steam-presence lives. That is so the icons.txt file
128+
# can be updated with new game icons (only when you use SteamGridDB).
129+
NoNewPrivileges=true
130+
ProtectSystem=strict
131+
ReadWritePaths=/home/deck/steam-presence
132+
133+
# This section is used when you run `systemctl --user enable steam-presence`.
134+
[Install]
135+
# WantedBy tells Systemd "when this service is enabled, it should be an
136+
# optional requirement of X".
137+
#
138+
# Normally, this is set to "multi-user.target". In Systemd 'system mode',
139+
# where Systemd is managing services for the OS, "multi-user.target" is the
140+
# correct thing to use. But because we are operating Systemd in 'user mode',
141+
# there is no "multi-user.target". Instead, there is "default.target".
142+
#
143+
# Once the OS is up, Systemd starts up a user-mode instance for us, and looks
144+
# for any services that are "wanted by" the "default.target". That is what
145+
# actually causes us to be launched at startup!
146+
WantedBy=default.target

0 commit comments

Comments
 (0)