Last active
March 29, 2025 23:52
-
-
Save pythoninthegrass/506e13de50a10ad2deeeac8d7098a16e to your computer and use it in GitHub Desktop.
sunshine, gamescope + steam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# TODO: test wayland gamescope session | |
export DISPLAY=:0 # vnc | |
export WAYLAND_DISPLAY=:2 # xwayland | |
export DXVK_HDR=1 | |
export ENABLE_GAMESCOPE_WSI=1 | |
# Check existing X server | |
start_x() { | |
pgrep X >/dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "Starting X server" | |
startx &>/dev/null & | |
if [[ $? -eq 0 ]]; then | |
echo "X server started successfully" | |
else | |
echo "X server failed to start" | |
fi | |
else | |
echo "X server already running" | |
fi | |
} | |
# Check if sunshine is already running | |
start_sunshine() { | |
pgrep sunshine >/dev/null | |
if [[ $? -ne 0 ]]; then | |
sudo ~/.local/bin/sunshine-setup.sh | |
echo "Starting Sunshine!" | |
sunshine > /dev/null & | |
if [[ $? -eq 0 ]]; then | |
echo "Sunshine started successfully" | |
else | |
echo "Sunshine failed to start" | |
fi | |
else | |
echo "Sunshine is already running" | |
fi | |
} | |
# start steam via gamescope | |
start_gamescope() { | |
pgrep steam >/dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "Starting Steam via Gamescope" | |
gamescope --headless -e \ | |
-W 1920 -H 1080 \ | |
--disable-color-management \ | |
-- steam \ | |
-gamepadui \ | |
-steamos3 \ | |
-steampal \ | |
-steamdeck \ | |
-pipewire-dmabuf \ | |
&> /dev/null & | |
if [[ $? -eq 0 ]]; then | |
echo "Steam started successfully" | |
else | |
echo "Steam failed to start" | |
fi | |
else | |
echo "Steam is already running" | |
fi | |
} | |
# Add any other Programs that you want to startup automatically | |
start_etc() { | |
firefox &> /dev/null & | |
kdeconnect-app &> /dev/null & | |
} | |
stop_process() { | |
sudo killall $1 2&> /dev/null || echo "$1 not running" | |
} | |
main() { | |
case $1 in | |
"on") | |
start_x | |
start_gamescope | |
start_sunshine | |
;; | |
"off") | |
set -a procs | |
procs=("gamescope" "sunshine" "steam" "startx") | |
for p in "${procs[@]}"; do | |
stop_process $p | |
done | |
;; | |
""|*) | |
echo -e "USAGE:\t./$(basename $0) <on|off>" | |
;; | |
esac | |
# start_etc | |
} | |
main "$@" |
Author
pythoninthegrass
commented
Apr 15, 2024
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment