feat: Add scripts and systemd services for SteamOS session management and game launching

This commit is contained in:
2025-10-31 19:57:42 +01:00
parent 7a7f2711fe
commit d42d717f6c
18 changed files with 63 additions and 13 deletions
@@ -36,6 +36,8 @@ start_gamescope() {
log "HDR disabled, no HDR flag added"
fi
env | tee -a "$LOG_FILE"
# Build gamescope argument array for safe quoting and readability
GAMESCOPE_ARGS=(
--generate-drm-mode fixed
@@ -82,10 +84,7 @@ start_kwin() {
exec dbus-run-session -- "$KWIN_BIN" ${KWIN_ARGS} "$@" >>"$LOG_FILE" 2>&1
}
export XDG_SEAT=seat0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
if [[ -f "$HOME/.desktop-session-plasma" ]]; then
log "Plasma session selected."
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
systemctl --user start steamos.target
@@ -1,10 +1,7 @@
[Unit]
Description=User session service
After=graphical-session.target systemd-user-sessions.service
Description=User graphical session service
After=steamos.target
[Service]
ExecStart=/usr/bin/bash /usr/local/bin/launch_session.sh
Restart=on-failure
[Install]
WantedBy=default.target
@@ -0,0 +1,10 @@
[Unit]
Description=SteamOS user graphical session service
After=graphical-session.target systemd-user-sessions.service
[Service]
ExecStart=/usr/bin/bash /usr/local/bin/steamos.sh
Restart=on-failure
[Install]
WantedBy=default.target
@@ -0,0 +1,15 @@
[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
+30 -5
View File
@@ -86,9 +86,34 @@
enabled: true
state: started
- name: Enable wake-on-lan on primary network interface
- name: Determine default network interface
ansible.builtin.set_fact:
primary_iface: "{{ ansible_default_ipv4.interface }}"
- name: Get NetworkManager connection name for primary interface
become: true
ansible.builtin.command: ethtool -s $(ip route show default | awk '/default/ {print $5}') wol g
ansible.builtin.command: >
bash -lc "nmcli -t -f NAME,DEVICE,TYPE c show --active |
awk -F: -v IF='{{ primary_iface }}' '$2==IF && $3==\"802-3-ethernet\"{print $1; exit}'"
register: nm_conn_name
changed_when: false
failed_when: nm_conn_name.stdout == ""
- name: Ensure WOL is persistent (magic) on the NM connection
become: true
ansible.builtin.shell: >
set -euo pipefail;
cur=$(nmcli -g 802-3-ethernet.wake-on-lan connection show "{{ nm_conn_name.stdout }}" | tr -d '[:space:]');
if [ "$cur" != "magic" ]; then
nmcli connection modify "{{ nm_conn_name.stdout }}" 802-3-ethernet.wake-on-lan magic;
echo changed;
fi
register: nm_wol_set
changed_when: "'changed' in nm_wol_set.stdout"
- name: Apply WOL for current boot
become: true
ansible.builtin.command: "ethtool -s {{ primary_iface }} wol g"
changed_when: false
failed_when: false
@@ -146,7 +171,7 @@
owner: root
group: root
mode: "0755"
loop: "{{ query('fileglob', 'game_station/system/*') }}"
loop: "{{ query('fileglob', 'game_station/bin/system/*') }}"
- name: Create system directories
become: true
@@ -306,7 +331,7 @@
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: "0755"
loop: "{{ query('fileglob', 'game_station/user/*') }}"
loop: "{{ query('fileglob', 'game_station/bin/user/*') }}"
- name: Write Gamescope configuration
become: true
@@ -332,7 +357,7 @@
become: true
become_user: "{{ user_name }}"
ansible.builtin.systemd:
name: session.service
name: steamos.service
enabled: true
state: started
scope: user