-
Notifications
You must be signed in to change notification settings - Fork 334
AppID detection for non-Steam games doesn't work in the Steam Flatpak #484
Description
Description
The elaborate trick to get the AppID of a non-Steam relies upon the assumption that executed non-Steam processes are descendants (in a parent-child relationship) of the reaper process.
This assumption breaks in the Steam Flatpak, becasue the Flatpak backend of pressure-vessel relies upon flatpak-portal (through a DBus API) to spawn non-Steam games inside a Flatpak subsandbox. This means that non-Steam game processes aren't directly executed by pressure-vessel, and therefore aren't descendants of the reaper process.
Since the AppID of non-Steam game windows can't be detected, gamescope doesn't give them focus and they remain forever in the background.
How to reproduce
Setup
Flatpak requires a separate DBus session in order to spawn processes through flatpak-portal in the context of separate X displays (such as gamescope's).
So either create a separate desktop session for gamescope + Steam Flatpak in your session manager of choice, or use the following scripts:
$ cat ./run-steam.sh
#!/bin/env bash
dbus-update-activation-environment --systemd \
DBUS_SESSION_BUS_ADDRESS \
DESKTOP_SESSION \
DISPLAY \
XAUTHORITY \
DESKTOP_SESSION \
XDG_CURRENT_DESKTOP \
XDG_MENU_PREFIX \
XDG_SESSION_CLASS \
XDG_SESSION_DESKTOP \
XDG_SESSION_TYPE
flatpak run com.valvesoftware.Steam -steamos3 -steampal -steamdeck -gamepadui
$ cat ./run-gamescope.sh
#!/bin/env bash
dbus-run-session -- gamescope --steam -f -- ./run-steam.sh
Note: make sure to execute Steam with -steamos3 -steampal -steamdeck -gamepadui (you may need to opt-into the Steam Deck version of Steam by following this short guide). This is important and currently required because of ValveSoftware/steam-for-linux#8513. In short, only the Steam Deck version of the Steam UI currently supports focusing non-Steam game windows through gamescope at all.
Reproduction steps
- Install the Flatpak version of Steam from Flathub.
- Run it through
gamescopein a new DBus session. (e.g., execute./run-gamescope.shabove.) - Run a non-Steam game using official Proton builds or the Steam Linux Runtime.
- Observe that the non-Steam game windows never gain focus.
- You can use
xwininfo -root -treeto confirm that the windows have actually opened. Just make sure to set theDISPLAYenvironment variable togamescope's X display.
- You can use
cc: @smcv