feat: Add Gamescope and Sunshine configuration files and update session management
This commit is contained in:
@@ -4,7 +4,6 @@ LOG_FILE="$HOME/.local/logs/session.log"
|
||||
|
||||
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOG_FILE"; }
|
||||
|
||||
|
||||
start_gamescope() {
|
||||
log "Starting Gamescope session..."
|
||||
|
||||
@@ -17,11 +16,11 @@ start_gamescope() {
|
||||
WIDTH="${RESOLUTION%x*}"
|
||||
HEIGHT="${RESOLUTION#*x}"
|
||||
|
||||
export __GL_GSYNC_ALLOWED=1
|
||||
export __GL_VRR_ALLOWED=1
|
||||
# export __GL_THREADED_OPTIMIZATIONS=1
|
||||
export __GL_SHADER_DISK_CACHE=1
|
||||
export __GL_SYNC_TO_VBLANK=0
|
||||
# export __GL_GSYNC_ALLOWED=1
|
||||
# export __GL_VRR_ALLOWED=1
|
||||
# # export __GL_THREADED_OPTIMIZATIONS=1
|
||||
# export __GL_SHADER_DISK_CACHE=1
|
||||
# export __GL_SYNC_TO_VBLANK=0
|
||||
|
||||
GAMESCOPE_BIN="$(command -v gamescope || true)"
|
||||
if [ -z "$GAMESCOPE_BIN" ]; then
|
||||
@@ -37,9 +36,28 @@ start_gamescope() {
|
||||
log "HDR disabled, no HDR flag added"
|
||||
fi
|
||||
|
||||
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 dbus-run-session -- "$GAMESCOPE_BIN" ${GAMESCOPE_ARGS} -- "$@" >>"$LOG_FILE" 2>&1
|
||||
# Build gamescope argument array for safe quoting and readability
|
||||
GAMESCOPE_ARGS=(
|
||||
--generate-drm-mode fixed
|
||||
--fade-out-duration 200
|
||||
--cursor-scale-height 720
|
||||
-f
|
||||
-W "$WIDTH" -H "$HEIGHT"
|
||||
-w "$WIDTH" -h "$HEIGHT"
|
||||
--rt --mangoapp -e
|
||||
-O "$OUTPUT_CONNECTOR"
|
||||
-r "$FRAMERATE"
|
||||
)
|
||||
|
||||
# Append HDR flag if enabled
|
||||
if [ -n "${HDR_FLAG:-}" ]; then
|
||||
GAMESCOPE_ARGS+=("$HDR_FLAG")
|
||||
fi
|
||||
|
||||
log "Launching Gamescope: $GAMESCOPE_BIN ${GAMESCOPE_ARGS[*]} -- $*"
|
||||
|
||||
# Execute gamescope inside a DBus session, preserving proper argument quoting
|
||||
exec dbus-run-session -- "$GAMESCOPE_BIN" "${GAMESCOPE_ARGS[@]}" -- "$@" >>"$LOG_FILE" 2>&1
|
||||
}
|
||||
|
||||
start_kwin() {
|
||||
@@ -64,6 +82,11 @@ 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."
|
||||
rm "$HOME/.desktop-session-plasma"
|
||||
|
||||
Reference in New Issue
Block a user