change: abstract flatpak ps command

This commit is contained in:
aclist committed 2026-11-12 11:37:13 +09:00
1 parent 047b9dbbf6
commit e8d7d9eb15
1 file changed
+7 -4
+7 -4
View File
@@ -30,16 +30,19 @@ def is_steam_running(cmd: str) -> bool:
def is_sandboxed() -> bool: def is_sandboxed() -> bool:
return bool(os.environ.get("FLATPAK_ID")) return bool(os.environ.get("FLATPAK_ID"))
def get_flatpak_output() -> list[str]:
proc = subprocess.check_output(
[FLATPAK_CMD, "ps", "--columns=application"], text=True
)
lines = proc.splitlines()
return lines
def is_flatpak_steam_running() -> bool: def is_flatpak_steam_running() -> bool:
if is_sandboxed(): if is_sandboxed():
return True return True
if has_cmd(FLATPAK_CMD) is False: if has_cmd(FLATPAK_CMD) is False:
return False return False
proc = subprocess.check_output( lines = get_flatpak_output()
[FLATPAK_CMD, "ps", "--columns=application"], text=True
)
lines = proc.splitlines()
if FLATPAK_APPID in lines: if FLATPAK_APPID in lines:
return True return True
return False return False