mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
feat: raise window (WIP)
This commit is contained in:
1 parent
90a1740bf0
commit
2b10fcaaad
10 files changed
+95
-46
No files matched your search
@@ -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])
|
||||
Reference in new issue
Block a user