From bb64592f5f16946f12b540a2ea7ce7444cf21ae5 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Wed, 21 Oct 2026 02:02:18 -0400 Subject: [PATCH] fix: browsers added as non-Steam games show their window and load pages in Gaming Mode (#1243) --- .../overlay/usr/local/bin/droiddeck-session | 6 ++++++ tools/tests/test_session_run_display.py | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 9240aa1505..adfa3ba866 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -358,6 +358,12 @@ case $mode in esac ;; steam) + if [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then + export WAYLAND_DISPLAY= XDG_SESSION_TYPE=x11 + fi + export MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_DISABLE_GMP_SANDBOX=1 MOZ_DISABLE_RDD_SANDBOX=1 + export MOZ_DISABLE_SOCKET_PROCESS_SANDBOX=1 MOZ_DISABLE_UTILITY_SANDBOX=1 + export MOZ_SHM_NO_SEALS=1 steam_x64=0 [ "${BL_STEAM_CLIENT_ARCH:-}" = x86_64 ] && steam_x64=1 steam_cef_gpu=1 diff --git a/tools/tests/test_session_run_display.py b/tools/tests/test_session_run_display.py index 5cf48817be..430a6a1373 100644 --- a/tools/tests/test_session_run_display.py +++ b/tools/tests/test_session_run_display.py @@ -13,6 +13,10 @@ def run_case(): return re.search(r"^ run\)\n.*?^ ;;\n", SESSION.read_text(), re.M | re.S).group(0) +def steam_display(): + return re.search(r"^ steam\)\n(.*?)^ steam_x64=0\n", SESSION.read_text(), re.M | re.S).group(1) + + class SessionRunDisplayTest(unittest.TestCase): def setUp(self): self.dir = Path(tempfile.mkdtemp()) @@ -41,6 +45,23 @@ class SessionRunDisplayTest(unittest.TestCase): def test_without_gamescope_the_display_is_left_alone(self): self.assertEqual(["wayland-0", "wayland"], self.display(WAYLAND_DISPLAY="wayland-0", XDG_SESSION_TYPE="wayland")) + def steam_env(self, **env): + base = {k: v for k, v in os.environ.items() + if k not in ("GAMESCOPE_WAYLAND_DISPLAY", "WAYLAND_DISPLAY", "XDG_SESSION_TYPE")} + script = steam_display() + ('printf "%s\\n" "${WAYLAND_DISPLAY-unset}" "${XDG_SESSION_TYPE-unset}"' + ' "${MOZ_SHM_NO_SEALS-unset}" "${MOZ_DISABLE_CONTENT_SANDBOX-unset}"\n') + run = subprocess.run(["bash", "-c", script], env={**base, **env}, capture_output=True, text=True, timeout=30) + self.assertEqual(0, run.returncode, run.stderr) + return run.stdout.splitlines() + + def test_steam_games_under_gamescope_cannot_reach_a_wayland_server(self): + self.assertEqual(["", "x11", "1", "1"], self.steam_env(GAMESCOPE_WAYLAND_DISPLAY="gamescope-0", + WAYLAND_DISPLAY="gamescope-0", XDG_SESSION_TYPE="wayland")) + + def test_steam_without_gamescope_keeps_the_display(self): + self.assertEqual(["wayland-0", "wayland", "1", "1"], + self.steam_env(WAYLAND_DISPLAY="wayland-0", XDG_SESSION_TYPE="wayland")) + if __name__ == "__main__": unittest.main()