feat: Update launch scripts for improved Gamescope and Steam integration, add custom EDID firmware, and enhance session management

This commit is contained in:
2025-11-10 14:07:12 +01:00
parent df2931ca81
commit 0cf0261359
5 changed files with 241 additions and 25 deletions
@@ -10,17 +10,19 @@ start_gamescope() {
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
# export __GL_SHADER_DISK_CACHE=1
# export __GL_SYNC_TO_VBLANK=0
export __GL_GSYNC_ALLOWED=1
export __GL_VRR_ALLOWED=1
export __GL_SHADER_DISK_CACHE=1
export __GL_SYNC_TO_VBLANK=0
export LIBVA_DRIVER_NAME=nvidia
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export NVD_BACKEND=direct
# export __GL_THREADED_OPTIMIZATIONS=1
GAMESCOPE_BIN="$(command -v gamescope || true)"
if [ -z "$GAMESCOPE_BIN" ]; then
@@ -36,8 +38,6 @@ 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
@@ -47,7 +47,6 @@ start_gamescope() {
-W "$WIDTH" -H "$HEIGHT"
-w "$WIDTH" -h "$HEIGHT"
--rt --mangoapp -e
-O "$OUTPUT_CONNECTOR"
-r "$FRAMERATE"
)
@@ -56,8 +55,12 @@ start_gamescope() {
GAMESCOPE_ARGS+=("$HDR_FLAG")
fi
log "Launching Gamescope: $GAMESCOPE_BIN ${GAMESCOPE_ARGS[*]} -- $*"
export XDG_CURRENT_DESKTOP=gamescope
export XDG_SESSION_TYPE=wayland
export DESKTOP_SESSION=gamescope
log "Launching Gamescope: $GAMESCOPE_BIN ${GAMESCOPE_ARGS[*]} -- $*"
sudo setcap 'CAP_SYS_NICE=eip' "$GAMESCOPE_BIN"
# Execute gamescope inside a DBus session, preserving proper argument quoting
exec dbus-run-session -- "$GAMESCOPE_BIN" "${GAMESCOPE_ARGS[@]}" -- "$@" >>"$LOG_FILE" 2>&1
}
@@ -72,10 +75,7 @@ start_kwin() {
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)
export DESKTOP_SESSION=plasma-wayland
# Ensure we don't run nested; width/height/fullscreen are for the windowed backend.
unset DISPLAY WAYLAND_DISPLAY
@@ -85,6 +85,9 @@ start_kwin() {
}
export XDG_SEAT=seat0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export XDG_DATA_DIRS=/usr/local/share/:/usr/share/
export XDG_CONFIG_DIRS=/usr/local/etc/xdg:/etc/xdg
if [[ -f "$HOME/.desktop-session-plasma" ]]; then
log "Plasma session selected."
@@ -3,8 +3,6 @@ set -euo pipefail
LOGFILE="$HOME/.local/logs/steam.log"
export PATH="$HOME/.local/bin:$PATH"
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
# There is no way to set a color space for an NV12
@@ -59,6 +57,13 @@ export STEAM_GAMESCOPE_VIRTUAL_WHITE=1
# Temporary crutch until dummy plane interactions / etc are figured out
export GAMESCOPE_DISABLE_ASYNC_FLIPS=1
# Use Vulkan for the Steam Overlay
export STEAM_OVERLAY_RENDERER=vk
# Set input method modules for Qt/GTK that will show the Steam keyboard
export QT_IM_MODULE=steam
export GTK_IM_MODULE=Steam
export XCURSOR_THEME=steam
export XCURSOR_SCALE=256
@@ -23,6 +23,10 @@ case "$session" in
;;
esac
if systemctl --user is-active --quiet sunshine.scope; then
log "Stopping sunshine.scope"
systemctl --user stop sunshine.scope
fi
if systemctl --user is-active --quiet steam.scope; then
log "Stopping steam.scope"
systemctl --user stop steam.scope
@@ -31,10 +35,6 @@ if systemctl --user is-active --quiet plasma.scope; then
log "Stopping plasma.scope"
systemctl --user stop plasma.scope
fi
if systemctl --user is-active --quiet sunshine.scope; then
log "Stopping sunshine.scope"
systemctl --user stop sunshine.scope
fi
sleep 5
log "Restarting graphical session service..."
systemctl --user restart session.service
@@ -0,0 +1,5 @@
AP///////wAhVwkhutc0AQ8iAQOARid4AiiVp1VOoyYPUFQhCADRwIHAAQABAAEAAQABAAEAAjqA
GHE4LUBYLEUAxI4hAAAeAAAA/QAYVR5kHgAKICAgICAgAAAA/ABIRCBUTyBVU0IKICAgAAAAEAAA
AAAAAAAAAAAAAAAAAZYCAzBxThAfIiEgBBM+PTxfZAUUIwkHB4MBAABuAwwAEAAAPCAAgAECAwTl
DmFgZmVqXgCgoKApUDAgJQCwEzIAABgZZACAo6AsULAQNRCwEzIAABgAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArw==