Skip to content

feat(steam): allow proper exit through power menu #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shawly
Copy link
Contributor

@shawly shawly commented Jun 8, 2025

steamos-dbus-watchdog.sh listens for dbus messages which are sent by Steam Big Picture's power menu and then sends a shutdown signal to steam using the -shutdown arg. This allows stopping using the power menu which is useful when using steam with -steamos/-steamdeck args.

We could also integrate something similar like to this script into the base-app image that SIGTERMs gamescope and sway when we detect a Shutdown signal on the DBus, this would add compatibility for other launchers that have a power menu, like Kodi for example and other frontends. At least if these frontends actually are using the D-Bus to communicate, which would require some testing.

@shawly shawly force-pushed the feature/steam-powermenu-shutdown branch from 163d8e6 to b5bce11 Compare June 9, 2025 05:49
steamos-dbus-watchdog.sh listens for dbus messages which are sent by Steam Big Picture's power menu and then sends a shutdown signal to steam using the -shutdown arg. This allows stopping using the power menu which is useful when using steam with -steamos/-steamdeck args.
@shawly shawly force-pushed the feature/steam-powermenu-shutdown branch from b5bce11 to def533a Compare June 9, 2025 08:06
@shawly shawly marked this pull request as ready for review June 9, 2025 08:06
@salty2011
Copy link
Member

This may seem like a stupid question.

But is this change to allow shutdown through say the steam container?

If so is that just shutting the container down or the host itself?

@shawly
Copy link
Contributor Author

shawly commented Jun 9, 2025

This may seem like a stupid question.

But is this change to allow shutdown through say the steam container?

If so is that just shutting the container down or the host itself?

This script only stops steam by executing steam -shutdown. As long as a container doesn't share the hosts dbus and has privilege Steam is not and will never able to shut down the host. The script simply watches the dbus for PowerOff, Suspend and Reboot calls and then calls steam -shutdown, so it doesn't do anything apart from telling the Steam process "please quit".

Giving privilege to containers isn't recommended, but if you actually want your host to shut down when your Steam container sends a Shutdown signal, you probably have to give the Steam container privilege and access to the system's dbus.

I have not tested the config below so I cannot guarantee that this will work, nor will I test this as I don't wanna shut down my server lol. But it "should" be fairly safe to run, the worst thing that will happen is that it will either not work at all or your host might need a reboot.

[[apps]]
title = "Steam"
icon_png_path = "https://games-on-whales.github.io/wildlife/apps/steam/assets/icon.png"

[apps.runner]
type = "docker"
name = "WolfSteam"
image = "ghcr.io/games-on-whales/steam:edge"
mounts = [
    "/sys/fs/cgroup:/sys/fs/cgroup",
    "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket",
    "/run/systemd/system:/run/systemd/system",
    "/bin/systemctl:/bin/systemctl"
]
env = [
    "RUN_SWAY=true",
    "GOW_REQUIRED_DEVICES=/dev/input/* /dev/dri/* /dev/nvidia*",
]
devices = []
ports = []
base_create_json = """
{
  "HostConfig": {
    "IpcMode": "host",
    "CapAdd": ["SYS_ADMIN", "SYS_NICE", "SYS_PTRACE", "NET_RAW", "MKNOD", "NET_ADMIN"],
    "SecurityOpt": ["seccomp=unconfined", "apparmor=unconfined"],
    "Ulimits": [{"Name":"nofile", "Hard":10240, "Soft":10240}],
    "Privileged": true,
    "DeviceCgroupRules": ["c 13:* rmw", "c 244:* rmw"]
  }
}
\
"""

I got the mounts from a Stackoverflow post, there is a chance you have to change them if you do not run a Debian based OS.

@salty2011
Copy link
Member

salty2011 commented Jun 9, 2025 via email

@shawly shawly changed the title feat(steam): allow shutdown through power menu feat(steam): allow proper exit through power menu Jun 9, 2025
@shawly
Copy link
Contributor Author

shawly commented Jun 9, 2025

You're right, the wording was kinda misleading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants