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
@@ -1,21 +1,22 @@
#!/bin/bash
set -euo pipefail
LOGFILE="$HOME/.local/logs/gamescope.log"
LOG_FILE="$HOME/.local/logs/session.log"
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOGFILE"; }
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOG_FILE"; }
CONF_FILE="$HOME/.config/gamescope/gamescope.conf"
[ -f "$CONF_FILE" ] && source "$CONF_FILE"
OUTPUT_CONNECTOR=${OUTPUT_CONNECTOR:-HDMI-A-1}
FRAMERATE=${FRAMERATE:-60}
RESOLUTION=${RESOLUTION:-1920x1080}
WIDTH="${RESOLUTION%x*}"
HEIGHT="${RESOLUTION#*x}"
start_gamescope() {
log "Starting Gamescope session..."
CONF_FILE="$HOME/.config/gamescope/gamescope.conf"
[ -f "$CONF_FILE" ] && source "$CONF_FILE"
OUTPUT_CONNECTOR=${OUTPUT_CONNECTOR:-HDMI-A-1}
FRAMERATE=${FRAMERATE:-60}
RESOLUTION=${RESOLUTION:-1920x1080}
WIDTH="${RESOLUTION%x*}"
HEIGHT="${RESOLUTION#*x}"
export __GL_GSYNC_ALLOWED=1
export __GL_VRR_ALLOWED=1
# export __GL_THREADED_OPTIMIZATIONS=1
@@ -38,7 +39,7 @@ start_gamescope() {
GAMESCOPE_ARGS="--generate-drm-mode fixed --fade-out-duration 200 --cursor-scale-height 720 -f -w $WIDTH -h $HEIGHT --rt --mangoapp -e -O \"$OUTPUT_CONNECTOR\" -r $FRAMERATE $HDR_FLAG"
log "Launching Gamescope: $GAMESCOPE_BIN $GAMESCOPE_ARGS -- $@"
exec "$GAMESCOPE_BIN" ${GAMESCOPE_ARGS} -- "$@" >>"$LOGFILE" 2>&1
exec dbus-run-session -- "$GAMESCOPE_BIN" ${GAMESCOPE_ARGS} -- "$@" >>"$LOG_FILE" 2>&1
}
start_kwin() {
@@ -49,9 +50,18 @@ start_kwin() {
exit 127
fi
KWIN_ARGS="--width $WIDTH --height $HEIGHT"
log "Launching KWin: $KWIN_BIN"
exec "$KWIN_BIN" ${KWIN_ARGS} "$@" >>"$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)
# Ensure we don't run nested; width/height/fullscreen are for the windowed backend.
unset DISPLAY WAYLAND_DISPLAY
KWIN_ARGS="--drm --exit-with-session"
log "Launching KWin (DRM): $KWIN_BIN ${KWIN_ARGS} $*"
exec dbus-run-session -- "$KWIN_BIN" ${KWIN_ARGS} "$@" >>"$LOG_FILE" 2>&1
}
if [[ -f "$HOME/.desktop-session-plasma" ]]; then
@@ -61,4 +71,5 @@ if [[ -f "$HOME/.desktop-session-plasma" ]]; then
else
log "Gamescope session selected."
start_gamescope /usr/local/bin/launch_steam.sh
fi
fi