Steam-Headless / docker-steam-headless

A Headless Steam Docker image supporting NVIDIA GPU and accessible via Web UI
GNU General Public License v2.0
730 stars 79 forks source link

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

Open luzfcb opened 2 weeks ago

luzfcb commented 2 weeks ago

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

Josh5 commented 1 week ago

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.

luzfcb commented 1 week ago

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

What profile?

Josh5 commented 1 week ago

@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.