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
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
LOGFILE="$HOME/.local/logs/gamescope.log"
export PATH="$HOME/.local/bin:$PATH"
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOGFILE"; }
# SDDM sets this to wayland but apps using Gamescope must use x11
export XDG_SESSION_TYPE=x11
# Update the enviroment with DESKTOP_SESSION and all XDG variables
log "Updating systemd user environment with XDG variables"
dbus-update-activation-environment --systemd DESKTOP_SESSION `env | grep ^XDG_ | cut -d = -f 1`
# This makes it so that xdg-desktop-portal doesn't find any portal implementations and doesn't start them and makes
# them crash/exit because the dbus env has no DISPLAY. In turn this causes dbus calls to the portal which don't rely
# on implementations to hang (such as SDL talking to the real time portal)
# Plasma resets this variable when it starts
systemctl --user set-environment XDG_DESKTOP_PORTAL_DIR=""
# Remove these as they prevent gamescope-session from starting correctly
systemctl --user unset-environment DISPLAY XAUTHORITY
# If this shell script is killed then stop gamescope-session
trap 'systemctl --user stop gamescope-session.target' HUP INT TERM
# Start gamescope-session and wait
log "Starting Gamescope Session"
systemctl --user --wait start gamescope-session.target &
wait
log "Gamescope Session Ended - Performing Final Cleanup"
# The 'wait' above blocks until gamescope-session.target stops
# We want to wait until *everything* has finished. We know systemd will have
# queued a stop job on graphical-session-pre aleady
# by also queuing up a job we can block until that completes
systemctl --user stop graphical-session-pre.target
log "Gamescope Session Ended - Cleanup Complete"