diff options
| -rw-r--r-- | fungus/game_launcher.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fungus/game_launcher.py b/fungus/game_launcher.py index 1382b15..3945249 100644 --- a/fungus/game_launcher.py +++ b/fungus/game_launcher.py @@ -135,6 +135,21 @@ class GameLauncher: self._watchdog_thread = Thread(target=self._watchdog_loop, daemon=True) self._watchdog_thread.start() + # ── Sleep inhibition ──────────────────────────────────────────── + + def _build_inhibit_prefix(self) -> list[str]: + """Return [systemd-inhibit, …] if available, else [].""" + systemd_inhibit = PathManager.find_binary("systemd-inhibit") + if not systemd_inhibit: + log.debug("systemd-inhibit not found; sleep inhibition unavailable") + return [] + return [ + systemd_inhibit, + "--what=sleep,idle", + "--why=Game is running", + "--mode=block", + ] + # ── Pure helpers ────────────────────────────────────────────────── @staticmethod @@ -437,7 +452,7 @@ class GameLauncher: run_env = os.environ.copy() run_env.update(sandbox_env) - full_cmd = bwrap_cmd + inner_cmd + full_cmd = self._build_inhibit_prefix() + bwrap_cmd + inner_cmd try: # we invoke popen() setting work directory as a dirname() of our executable |
