docker-steam-headless icon indicating copy to clipboard operation
docker-steam-headless copied to clipboard

Ensure Steam is started as a child process of /usr/bin/sunshine-run

Open luzfcb opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?

Yes.

In the process of figuring out why I could connect on Sunshine via moonlight but the sometimes the controls on Steam didn't work, I discovered that the controls only work if and only if Steam is launched via /usr/bin/sunshine-run like /usr/bin/sunshine-run /usr/games/steam steam://open /bigpicture .

This is also the same for Heroic Game Launcher and others. In other words, for control via Moonlight to work, the software must be a child process of Sunshine's /usr/bin/sunshine-run command.

The problem is that docker-steam-headless starts Steam in some places independently of sunshine-run :

https://github.com/Steam-Headless/docker-steam-headless/blob/47f6f7a176ee0c6f6c870c29397cc1a8d6d57839/overlay/etc/supervisor.d/steam.ini#L13

https://github.com/Steam-Headless/docker-steam-headless/blob/47f6f7a176ee0c6f6c870c29397cc1a8d6d57839/overlay/etc/cont-init.d/90-configure_steam.sh#L10

and also the session autostart Steam option and the shortcuts on the menu

What is your feature request?

Ensure Steam is started as a child process of /usr/bin/sunshine-run in all parts that maybe start steam automatically or manually, like the Steam entry on the menu and all the autostart scripts

Are there any workarounds?

I replaced the default "Detached Commands" of the Steam Big Picture application configuration inside Sunshine

from

/usr/bin/sunshine-run /usr/games/steam steam://open/bigpicture

to

/mnt/games/mycustom_helpers/start_steam_via_sunshine.sh

This is the content of the start_steam_via_sunshine.sh command

#!/bin/bash

echo "Stopping Steam"

# Check if Steam is running before attempting to stop it
if ps h -C steam > /dev/null; then
    /usr/games/steam steam://exit
else
    echo "Steam is not running."
fi

# Wait for Steam to stop
while ps h -C steam > /dev/null; do
    echo "Waiting for Steam to stop..."
    sleep 1
done

echo "Starting Steam Big Picture via Sunshine"
/usr/bin/sunshine-run /usr/games/steam steam://open/bigpicture

I read https://developer.valvesoftware.com/wiki/Command_line_options#SteamCMD and just tested the commands and discovered that I can make Steam exit and close via /usr/games/steam steam://exit

Note: The best way to ensure that everything will always work is to force quit Steam even if Steam was launched via sunshine-run, but quitting and starting Steam again is a slow process.

Maybe it would be better to improve my script so as not to force exit if it was started via sunshine-run

Additional Context

No response

luzfcb avatar Jun 18 '24 01:06 luzfcb

This is interesting. I have not experienced this myself.

One thing i would point out is that by stopping steam and restarting it every time you connect via sunshine, it means I would also always need to select the profile each time. This means steam link would stop working after using a sunshine session.

Josh5 avatar Jun 20 '24 01:06 Josh5

@Josh5 What did you mean by always need to select the profile each time?

What profile?

luzfcb avatar Jun 20 '24 12:06 luzfcb

@Josh5 What did you mean by always need to select the profile each time?

What profile?

Selecting which user to log into steam as. My setup has my whole family.

Josh5 avatar Jun 21 '24 20:06 Josh5