diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-07-05 18:02:50 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-07-05 18:02:50 +0300 |
| commit | 04f41e4e5b79aa31bf2080d099c3dd790dfbd6fb (patch) | |
| tree | c58ffb500ca9dc76b5fb9ee45251af559d661864 /fungus | |
| parent | 63c86b7d5a54a9a3723e29658c479e409bcd9599 (diff) | |
| download | fungus-launcher-04f41e4e5b79aa31bf2080d099c3dd790dfbd6fb.tar.gz fungus-launcher-04f41e4e5b79aa31bf2080d099c3dd790dfbd6fb.tar.xz | |
fix missing systemd-inhibit sleep+idle while running a game
Diffstat (limited to 'fungus')
| -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 |
