From 9c9486400b7701d4d9b7c909f7c51fb949e4c7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Resul=20=C3=96v=C3=BCr?= <92828257+ovurrsl@users.noreply.github.com> Date: Sat, 17 Oct 2026 00:21:53 +0300 Subject: [PATCH] Launch an added game after a bounded wait for its Steam overview (#973) --- .../overlay/usr/local/bin/droiddeck-session | 9 ++--- tools/tests/test_steam_cold_launch.py | 33 ++++++++++++------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index da85c10a6..2cc48280a 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -545,10 +545,10 @@ case $mode in until [ "$(xprop -root GAMESCOPE_FOCUSED_APP 2>/dev/null | sed -n 's/.*= *//p')" = 769 ] || [ "$SECONDS" -ge "$_bl_end" ]; do sleep 1 done - # A large library can take longer than one 45 s wait to load. + # With a large library the overview can stay missing for 30+ minutes while Steam already takes the launch URL. _bl_overview_status=1 _bl_overview_tries=0 - while [ "$_bl_overview_tries" -lt 40 ]; do + while [ "$_bl_overview_tries" -lt 2 ]; do if /usr/local/bin/droiddeck-agent --wait-steam-shortcut-overview "$_bl_held" 45; then _bl_overview_status=0 else @@ -558,7 +558,7 @@ case $mode in break fi _bl_overview_tries=$((_bl_overview_tries + 1)) - echo "== steam: shortcut overview not ready yet; Steam may still be loading the library (attempt $_bl_overview_tries of 40)" + echo "== steam: shortcut overview not ready yet (attempt $_bl_overview_tries of 2)" sleep 2 done if [ "$_bl_overview_status" -eq 0 ]; then @@ -569,7 +569,8 @@ case $mode in sleep 4 _bl_launch_ready=1 else - echo "== steam: expected shortcut overview did not become ready; holding the launch URL" + echo "== steam: shortcut overview not ready after about 90 s; launching the requested game anyway $_bl_held" + _bl_launch_ready=1 fi if [ "$_bl_launch_ready" = 1 ]; then echo "== steam: interface up; launching the requested game $_bl_held" diff --git a/tools/tests/test_steam_cold_launch.py b/tools/tests/test_steam_cold_launch.py index 114ba1f5b..9dfd10f2e 100644 --- a/tools/tests/test_steam_cold_launch.py +++ b/tools/tests/test_steam_cold_launch.py @@ -78,21 +78,30 @@ class SteamColdLaunchTest(unittest.TestCase): self.assertEqual(["--wait-steam-shortcut-overview", game_id, "45"], self.agent_args.read_text().splitlines()) self.assertEqual("4", self.sleep_args.read_text().strip()) - def test_shortcut_without_the_expected_overview_does_not_forward_cgameid(self): + def test_a_shortcut_whose_overview_never_appears_is_launched_after_a_bounded_wait(self): game_id = str((3551182975 << 32) | 0x02000000) result = self.run_launch(game_id, 1) - self.assertFalse((self.launch_dir / "steam-game").exists(), result.stdout) - self.assertEqual(["--wait-steam-shortcut-overview", game_id, "45"], self.agent_args.read_text().splitlines()) - self.assertEqual("40", self.agent_count.read_text().strip()) - self.assertEqual(["2"] * 40, self.sleep_args.read_text().split()) - - def test_a_slow_steam_library_still_gets_its_game_launched(self): - game_id = str((3551182975 << 32) | 0x02000000) - result = self.run_launch(game_id, "1 1 1 0") self.assertEqual(game_id, (self.launch_dir / "steam-game").read_text().strip(), result.stdout) - self.assertEqual("4", self.agent_count.read_text().strip()) - self.assertEqual(["2", "2", "2"], self.sleep_args.read_text().split()) - self.assertIn("attempt 3 of 40", result.stdout) + self.assertEqual(["--wait-steam-shortcut-overview", game_id, "45"], self.agent_args.read_text().splitlines()) + self.assertEqual("2", self.agent_count.read_text().strip()) + self.assertEqual(["2", "2"], self.sleep_args.read_text().split()) + self.assertIn("launching the requested game anyway", result.stdout) + + def test_a_late_overview_is_still_waited_for_once_more(self): + game_id = str((3551182975 << 32) | 0x02000000) + result = self.run_launch(game_id, "1 0") + self.assertEqual(game_id, (self.launch_dir / "steam-game").read_text().strip(), result.stdout) + self.assertEqual("2", self.agent_count.read_text().strip()) + self.assertEqual(["2"], self.sleep_args.read_text().split()) + self.assertIn("attempt 1 of 2", result.stdout) + self.assertNotIn("anyway", result.stdout) + + def test_an_agent_failure_other_than_a_timeout_launches_without_retrying(self): + game_id = str((3551182975 << 32) | 0x02000000) + result = self.run_launch(game_id, 2) + self.assertEqual(game_id, (self.launch_dir / "steam-game").read_text().strip(), result.stdout) + self.assertEqual("1", self.agent_count.read_text().strip()) + self.assertFalse(self.sleep_args.exists()) def test_non_game_steam_urls_remain_on_the_original_startup_arguments(self): url = "steam://open/library"