feat: raise window (WIP)

This commit is contained in:
aclist committed 2026-05-07 16:09:41 +09:00
1 parent 90a1740bf0
commit 2b10fcaaad
10 files changed
+95 -46

No files matched your search

+19
View File
@@ -1,10 +1,14 @@
import psutil
import subprocess
import shutil
import sys
from dzgui.const.constants import DAYZ_BINARY, STEAM_CMD
from dzgui.views.dialogs.early_alert import EarlyAlertDialog
from dzgui.util.strings import init
# TODO: move to util.proc
# TODO: simplify
def is_dayz_running(dialog: bool = False) -> bool | None:
@@ -29,3 +33,18 @@ def is_running(proc: str) -> bool:
if process.info["name"] == proc:
return True
return False
def has_cmd(cmd: str) -> bool:
if shutil.which(cmd) is not None:
return True
return False
def foreground(cmd: str, pid: int) -> None:
if cmd == "wmctrl":
# TODO: convert wid from hexadecimal
args = [cmd, "-a", "DZGUI"]
elif cmd == "xdotool":
args = [cmd, "search", "--onlyvisible", "--name", "DZGUI", "windowactivate"]
subprocess.Popen([*args])