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
+12 -3
View File
@@ -77,7 +77,8 @@ def find_game_window(pids: set[int]) -> int | None:
win32gui.EnumWindows(callback, None) win32gui.EnumWindows(callback, None)
if not found: if not found:
return None 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] return found[0][0]
@@ -155,7 +156,8 @@ def bring_to_front(hwnd: int) -> bool:
def main() -> None: def main() -> None:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--timeout", type=int, default=120) 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() args = parser.parse_args()
deadline = time.time() + args.timeout deadline = time.time() + args.timeout
@@ -199,8 +201,15 @@ def main() -> None:
current_hwnd = find_game_window(pids) current_hwnd = find_game_window(pids)
if current_hwnd and current_hwnd != hwnd: if current_hwnd and current_hwnd != hwnd:
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", logging.info("Window changed: old=%s new=%s title=%r",
hwnd, current_hwnd, win32gui.GetWindowText(current_hwnd)) hwnd, current_hwnd, new_title)
hwnd = current_hwnd hwnd = current_hwnd
focused_hwnd = None # neues Fenster muss neu fokussiert werden focused_hwnd = None # neues Fenster muss neu fokussiert werden
time.sleep(1) time.sleep(1)
+7 -1
View File
@@ -1,7 +1,13 @@
Set WshShell = CreateObject("WScript.Shell") Set WshShell = CreateObject("WScript.Shell")
' Prozessname aus dem ersten Argument (Steam %command%) extrahieren
Dim exePath, fso, exeName
Set fso = CreateObject("Scripting.FileSystemObject")
exePath = WScript.Arguments(0)
exeName = fso.GetBaseName(exePath)
' Foreground-Fix Script unsichtbar starten (pythonw = kein Konsolenfenster) ' Foreground-Fix Script unsichtbar starten (pythonw = kein Konsolenfenster)
WshShell.Run """C:\Projekte\Steam_backgroud_fix\.venv\Scripts\pythonw.exe"" ""C:\Projekte\Steam_backgroud_fix\foreground_fix.py""", 0, False WshShell.Run """C:\Projekte\Steam_backgroud_fix\.venv\Scripts\pythonw.exe"" ""C:\Projekte\Steam_backgroud_fix\foreground_fix.py"" --process """ & exeName & """", 0, False
' Spiel starten: alle Argumente (= Steam %command%) zusammensetzen und ausführen ' Spiel starten: alle Argumente (= Steam %command%) zusammensetzen und ausführen
Dim gameCmd, i Dim gameCmd, i