diff --git a/dotfiles/.config/sunshine/scripts/sunshine-games.sh b/dotfiles/.config/sunshine/scripts/sunshine-games.sh new file mode 100755 index 0000000..2b0d79e --- /dev/null +++ b/dotfiles/.config/sunshine/scripts/sunshine-games.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Sunshine global_prep_cmd: make games launched during a stream open on the +# headless stream output instead of whichever physical monitor had focus. +# start -> enable the "sunshine-games" Hyprland window rule (layout/windowrules.lua: +# steam_app_* -> workspace 9 on HEADLESS-1, fullscreen) and make +# HEADLESS-1 the XWayland primary output, which Wine/Proton uses for +# fullscreen mode changes and scaling +# stop -> disable the rule and clear the primary output again +# Games that pick their render size at launch (KOTOR etc.) otherwise come up +# on a desk monitor and stay tiny in a corner when moved to the stream. + +case "$1" in + start) + hyprctl eval 'SunshineGamesRule:set_enabled(true)' + xrandr --output HEADLESS-1 --primary 2>/dev/null + ;; + stop) + hyprctl eval 'SunshineGamesRule:set_enabled(false)' + xrandr --noprimary 2>/dev/null + ;; + *) + echo "Usage: $0 start|stop" >&2 + exit 1 + ;; +esac +exit 0 diff --git a/dotfiles/.config/sunshine/sunshine.conf b/dotfiles/.config/sunshine/sunshine.conf index 8305557..7d7e30b 100644 --- a/dotfiles/.config/sunshine/sunshine.conf +++ b/dotfiles/.config/sunshine/sunshine.conf @@ -2,4 +2,4 @@ audio_sink = sink-sunshine-stereo csrf_allowed_origins = https://xol.twhomelab.local:47990 nvenc_preset = 4 output_name = HEADLESS-1 -global_prep_cmd = [{"do":"/home/thomas/.config/hypr/scripts/SunshineIdle.sh start","undo":"/home/thomas/.config/hypr/scripts/SunshineIdle.sh stop"}] +global_prep_cmd = [{"do":"/home/thomas/.config/hypr/scripts/SunshineIdle.sh start","undo":"/home/thomas/.config/hypr/scripts/SunshineIdle.sh stop"},{"do":"/home/thomas/.config/sunshine/scripts/sunshine-games.sh start","undo":"/home/thomas/.config/sunshine/scripts/sunshine-games.sh stop"}]