sunshine: wrap the resolution prep-cmd in sh -c

eb6a42c set HEADLESS-1 from SUNSHINE_CLIENT_WIDTH/HEIGHT/FPS but never
actually ran: Sunshine execs a prep-cmd directly, with no shell, so ${...}
was passed through literally. swaymsg received "mode ${SUNSHINE_CLIENT_WIDTH}
x..." as its argument, exited 2, and Sunshine reports any failed prep-cmd to
the client as the one opaque "failed to start the specified application".

The variable names were right and Sunshine does export them; the shell was
the missing part, which is why upstream's own example wraps the command.
Verified live at 2560x1440@60 and 1920x1080@120.

Worth keeping for the next time this breaks: swaymsg exits 2 when the socket
is reachable and the command is rejected, and 1 when it cannot find the
socket at all. That distinction is what ruled out a SWAYSOCK problem and
confirmed the malformed mode string without guessing.
This commit is contained in:
2026-09-15 12:06:25 -04:00
parent eb6a42c4d7
commit 79da785ed4
+2 -2
View File
@@ -8,7 +8,7 @@
"image-path": "desktop.png",
"prep-cmd": [
{
"do": "swaymsg output HEADLESS-1 mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz",
"do": "sh -c \"swaymsg output HEADLESS-1 mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz\"",
"undo": "swaymsg output HEADLESS-1 mode 1920x1080@60Hz"
}
]
@@ -18,7 +18,7 @@
"image-path": "steam.png",
"prep-cmd": [
{
"do": "swaymsg output HEADLESS-1 mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz",
"do": "sh -c \"swaymsg output HEADLESS-1 mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz\"",
"undo": "swaymsg output HEADLESS-1 mode 1920x1080@60Hz"
}
],