feat: Add configuration and scripts for Sunshine and Gamescope integration

This commit is contained in:
2025-10-28 00:04:17 +01:00
parent 49de842b57
commit 9fa68f3bc5
11 changed files with 207 additions and 76 deletions
@@ -5,19 +5,64 @@ export PATH="$HOME/.local/bin:$PATH"
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOGFILE"; }
DESKTOP_BIN="$(command -v startplasma-wayland || true)"
DESKTOP_BIN="$(command -v plasmashell || true)"
if [ -z "$DESKTOP_BIN" ]; then
log "ERROR: startplasma-wayland not found in PATH"
log "ERROR: plasmashell not found in PATH"
exit 127
fi
log "Launching Plasma: $DESKTOP_BIN"
exec $DESKTOP_BIN >>"$LOGFILE" 2>&1 &
export XDG_CURRENT_DESKTOP=plasma
export XDG_SESSION_TYPE=wayland
export XDG_DATA_DIRS=/usr/local/share/:/usr/share/
export XDG_CONFIG_DIRS=/usr/local/etc/xdg:/etc/xdg
export XDG_CURRENT_DESKTOP=KDE
export XDG_RUNTIME_DIR=/run/user/$(id -u)
sleep 5
systemd-run --user --slice=sunshine.slice --scope sunshine >>"$LOGFILE" 2>&1 || {
log "ERROR: Failed to start Sunshine"
exit 1
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
export CLUTTER_BACKEND=wayland
export SDL_VIDEODRIVER=wayland
export MOZ_ENABLE_WAYLAND=1
export KDEDIRS=/usr
export KDE_FULL_SESSION=true
export DESKTOP_SESSION=plasma
unset DISPLAY
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
log "Launching Plasma: $DESKTOP_BIN"
systemd-run --user --scope --quiet \
--unit=plasma.scope \
--slice=desktop.slice \
"$DESKTOP_BIN" >>"$LOGFILE" 2>&1 &
plasma_scope_pid=$!
log "Plasma started with scope pid $plasma_scope_pid"
{
SUNSHINE_BIN="$(command -v sunshine || true)"
if [ -z "$SUNSHINE_BIN" ]; then
log "ERROR: sunshine not found in PATH"
else
SUNSHINE_LOG_FILE="$HOME/.local/logs/sunshine.log"
log "Found Sunshine: $SUNSHINE_BIN, starting after 5s delay"
sleep 5
systemd-run --user --scope --quiet \
--unit=sunshine.scope \
--slice=sunshine.slice \
"$SUNSHINE_BIN" "$HOME/.config/sunshine/sunshine.conf"
fi
} &
tail -f /dev/null
wait "$plasma_scope_pid"
status=$?
# Stop Sunshine gracefully
if systemctl --user is-active --quiet sunshine.scope; then
log "Stopping Sunshine"
systemctl --user stop sunshine.scope
fi
log "Plasma session ended."
exit "$status"