Prozessname automatisch erkennen und titellose Overlay-Fenster ignorieren.

- Prozessname automatisch aus Steam %command% extrahieren (launch.vbs + --process required)
- Titellose Overlay-Fenster ignorieren (Wuthering Waves Fix) (Fensterauswahl + Wechsellogik)
This commit is contained in:
Andre
2026-04-04 12:25:43 +02:00
parent 8625bb0188
commit 0d9fb7e54c
2 changed files with 23 additions and 8 deletions
+16 -7
View File
@@ -77,7 +77,8 @@ def find_game_window(pids: set[int]) -> int | None:
win32gui.EnumWindows(callback, None)
if not found:
return None
found.sort(key=lambda x: x[2] * x[3], reverse=True)
# Fenster mit Titel bevorzugen, dann nach Größe sortieren
found.sort(key=lambda x: (bool(x[1]), x[2] * x[3]), reverse=True)
return found[0][0]
@@ -155,7 +156,8 @@ def bring_to_front(hwnd: int) -> bool:
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--timeout", type=int, default=120)
parser.add_argument("--process", type=str, default="CrimsonDesert")
parser.add_argument("--process", type=str, required=True,
help="Prozessname des Spiels (ohne .exe)")
args = parser.parse_args()
deadline = time.time() + args.timeout
@@ -199,11 +201,18 @@ def main() -> None:
current_hwnd = find_game_window(pids)
if current_hwnd and current_hwnd != hwnd:
logging.info("Window changed: old=%s new=%s title=%r",
hwnd, current_hwnd, win32gui.GetWindowText(current_hwnd))
hwnd = current_hwnd
focused_hwnd = None # neues Fenster muss neu fokussiert werden
time.sleep(1)
new_title = win32gui.GetWindowText(current_hwnd)
old_title = win32gui.GetWindowText(hwnd) if hwnd else ""
# Nicht von einem Fenster mit Titel auf ein titelloses wechseln
if not new_title and old_title:
logging.debug("Ignoring titleless window hwnd=%s (keeping %s title=%r)",
current_hwnd, hwnd, old_title)
else:
logging.info("Window changed: old=%s new=%s title=%r",
hwnd, current_hwnd, new_title)
hwnd = current_hwnd
focused_hwnd = None # neues Fenster muss neu fokussiert werden
time.sleep(1)
if not hwnd:
time.sleep(FOCUS_RETRY_DELAY)