Refactor SteamOS session management and launcher scripts

- Removed obsolete launch_desktop.sh and launch_session.sh scripts.
- Introduced new steam-launcher script to handle Steam launching and session tracking.
- Added steam-short-session-tracker for monitoring short Steam sessions and triggering repairs.
- Created steamos and steamos-session scripts for managing the SteamOS session.
- Implemented steamos-session-select for switching between Gamescope and Plasma sessions.
- Updated SDDM configuration for autologin and session management.
- Added new systemd services and targets for managing Gamescope and Steam sessions.
- Created desktop entries and icons for ALVR and SteamOS shortcuts.
- Enhanced logging and error handling across scripts.
- Cleaned up unused systemd slice and service files.
- Updated Ansible playbook to reflect new configurations and file structures.
This commit is contained in:
2025-12-01 17:25:18 +01:00
parent edbe8fbf6f
commit b4f4fe2f07
33 changed files with 518 additions and 345 deletions
@@ -1,3 +0,0 @@
[Slice]
CPUWeight=100
AllowedCPUs={{ general_cores }}
@@ -0,0 +1,11 @@
[Unit]
Description=mangoapp
After=graphical-session.target
PartOf=graphical-session.target
[Service]
Type=exec
ExecStart=/usr/bin/mangoapp
Restart=always
EnvironmentFile=%t/gamescope-environment
TimeoutStopSec=5
@@ -0,0 +1,17 @@
[Unit]
Description=Gamescope Session
Before=graphical-session.target
PartOf=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
RefuseManualStart=yes
[Service]
TimeoutStartSec=5
TimeoutStopSec=10
ExecStart=gamescope-session
Type=notify
NotifyAccess=all
# Make Steam's srt-logger write to the journal with it's own prefixes
Environment=SRT_LOG_TO_JOURNAL=1
Slice=session.slice
@@ -0,0 +1,13 @@
[Unit]
Description=Gamescope Session
Requires=graphical-session.target
BindsTo=graphical-session.target
After=graphical-session.target
Requires=gamescope-session.service
BindsTo=gamescope-session.service
Upholds=steam-launcher.service
Wants=ibus-gamescope.service
Wants=gamescope-mangoapp.service
@@ -0,0 +1,12 @@
[Unit]
Description=Wrapper for Ibus
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Type=dbus
ExecStart=/usr/bin/ibus-daemon -r --panel=disable --emoji-extension=disable
BusName=org.freedesktop.IBus
EnvironmentFile=%t/gamescope-environment
Slice=session.slice
TimeoutStopSec=5
@@ -1,7 +0,0 @@
[Unit]
Description=User graphical session service
After=steamos.target
[Service]
ExecStart=/usr/bin/bash /usr/local/bin/launch_session.sh
Restart=on-failure
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=User Core Session Slice
Documentation=man:systemd.special(7)
[Slice]
CPUWeight=100
@@ -0,0 +1,22 @@
[Unit]
Description=Steam Launcher
After=gamescope-session.target
PartOf=gamescope-session.target
[Service]
ExecStart=steam-launcher
# Track short sessions to trigger a repair after enough failures
ExecStartPre=steam-short-session-tracker --track-started
ExecStopPost=steam-short-session-tracker --track-stopped
# To close properly we need to kill the child of the steam wrapper, as the wrapper itself does not forward signals
ExecStop=/bin/bash -c 'kill -TERM $(pgrep -P $MAINPID || echo $MAINPID)'
# Disable the term signal sent from systemd, as we we handle it manually above
# But still want systemd to kill the entire cgroup on timeout
KillSignal=SIGCONT
KillMode=mixed
TimeoutStopSec=60
Type=exec
EnvironmentFile=%t/gamescope-environment
@@ -1,3 +1,15 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=User Core Session Slice
Documentation=man:systemd.special(7)
[Slice]
CPUWeight=100
AllowedCPUs={{ general_cores }}
CPUWeight=100
@@ -1,10 +1,8 @@
[Unit]
Description=SteamOS user graphical session service
After=graphical-session.target systemd-user-sessions.service
Description=User graphical session service
After=graphical-session.target
[Service]
ExecStart=/usr/bin/bash /usr/local/bin/steamos.sh
ExecStart=/usr/local/bin/steamos
EnvironmentFile=%t/steamos-environment
Restart=on-failure
[Install]
WantedBy=default.target
@@ -1,15 +0,0 @@
[Unit]
Description=SteamOS Target
Requires=graphical-session.target
BindsTo=graphical-session.target
After=graphical-session.target
PropagatesStopTo=graphical-session.target
Requires=session.service
BindsTo=session.service
# Wants=ibus-gamescope.service
# Wants=steam-notif-daemon.service
# Wants=gamescope-xbindkeys.service
# Wants=galileo-mura-setup.service
# Wants=gamescope-mangoapp.service
@@ -1,3 +1,15 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=User Core Session Slice
Documentation=man:systemd.special(7)
[Slice]
CPUWeight=100
AllowedCPUs={{ sunshine_cores }}
CPUWeight=100