Repository navigation
Expand file tree
/
Copy pathlaunch
More file actions
executable file
·129 lines (113 loc) · 4.04 KB
/
Copy pathlaunch
File metadata and controls
executable file
·129 lines (113 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
set -e
# Default values
GAMESCOPE_BACKEND=""
GAMESCOPE_RESOLUTION=""
DEFAULT_SESSION=""
HEADLESS_DEBUG=""
# Help message
show_help() {
cat << EOF
Usage: ./launch [OPTIONS]
Launch steam-headless container with configurable options.
OPTIONS:
-b, --backend BACKEND Set gamescope backend (sdl, headless, auto, etc.)
-r, --resolution RES Set gamescope resolution by name:
- 360p: 640x360
- 480p: 640x480
- 720p: 1280x720
- 1080p: 1920x1080 (default)
- 1440p: 2560x1440
- 4k: 3840x2160
-s, --session SESSION Set default session (steam, desktop, shell)
-d, --debug FLAGS Set debug flags (comma-separated):
- wlserver: Enable Wayland server debug logging
- xwm: Enable X window manager debug logging
- focus: Enable gamescope focus debugging
- gs_ei: Enable gamescope emulated input debugging
- uinput: Enable uinput-daemon debug logging
- uinputld: Enable uinput preload library debug logging
- uinput_extra: Enable extra intercepts and uevents
- ALL: Enable all debug flags
-h, --help Show this help message
EXAMPLES:
./launch # Launch with defaults
./launch -r 720p # Launch at 720p resolution
./launch -b sdl -s steam # SDL backend with Steam session
./launch --debug wlserver,xwm # Enable input debugging
./launch -b sdl -d focus # SDL backend with focus debugging
./launch -d ALL # Enable all debug flags
./launch --backend sdl --session desktop --debug ALL # All options with full debugging
EOF
exit 0
}
# Parse arguments using getopt (supports long options)
TEMP=$(getopt -o b:r:s:d:h --long backend:,resolution:,session:,debug:,help -n 'launch' -- "$@")
if [ $? != 0 ]; then
echo >&2
show_help
fi
eval set -- "$TEMP"
while true; do
case "$1" in
-b|--backend)
GAMESCOPE_BACKEND="$2"
shift 2
;;
-r|--resolution)
GAMESCOPE_RESOLUTION="$2"
shift 2
;;
-s|--session)
DEFAULT_SESSION="$2"
shift 2
;;
-d|--debug)
if [ "$2" = "ALL" ]; then
HEADLESS_DEBUG="wlserver,xwm,focus,gs_ei,uinput,uinputld,uinput_extra"
else
HEADLESS_DEBUG="$2"
fi
shift 2
;;
-h|--help)
show_help
;;
--)
shift
break
;;
*)
echo "Internal error!" >&2
exit 1
;;
esac
done
# Show configuration
echo "===== Steam Headless Launch Configuration ====="
echo "GAMESCOPE_BACKEND: ${GAMESCOPE_BACKEND:-<default>}"
echo "GAMESCOPE_RESOLUTION: ${GAMESCOPE_RESOLUTION:-<default>}"
echo "DEFAULT_SESSION: ${DEFAULT_SESSION:-<default>}"
echo "HEADLESS_DEBUG: ${HEADLESS_DEBUG:-<none>}"
echo "==============================================="
echo
# Determine compose files
COMPOSE_FILES="-f docker-compose.yaml"
if [ -f docker-compose.local-override.yaml ]; then
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.local-override.yaml"
else
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.ports.yaml"
if [ -f docker-compose.local.yaml ]; then
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.local.yaml"
fi
fi
# Launch container
rm -rf steam-data/logs
mkdir -p steam-data/logs
docker compose $COMPOSE_FILES down -v
docker compose $COMPOSE_FILES build
GAMESCOPE_BACKEND="$GAMESCOPE_BACKEND" \
GAMESCOPE_RESOLUTION="$GAMESCOPE_RESOLUTION" \
DEFAULT_SESSION="$DEFAULT_SESSION" \
HEADLESS_DEBUG="$HEADLESS_DEBUG" \
exec docker compose $COMPOSE_FILES up