From 87e6b5c6652a3ee6359a6a043ffa980c266f35ca Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 13 Mar 2026 13:39:42 -0400 Subject: [PATCH] more win32 wrap --- src/gui_2.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gui_2.py b/src/gui_2.py index 657068a..e090686 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -29,6 +29,7 @@ from src import mcp_client from src import markdown_helper from src import bg_shader import re +import subprocess if sys.platform == "win32": import win32gui import win32con @@ -4024,15 +4025,16 @@ def hello(): user_scale = theme.get_current_scale() self.runner_params.dpi_aware_params.dpi_window_size_factor = user_scale - # Detect Monitor Refresh Rate for capping + # Detect Monitor Refresh Rate for capping (Win32 only) fps_cap = 60.0 - try: - # Use PowerShell to get max refresh rate across all controllers - cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\"" - out = subprocess.check_output(cmd, shell=True).decode().splitlines() - rates = [float(r.strip()) for r in out if r.strip().isdigit()] - if rates: fps_cap = max(rates) - except Exception: pass + if sys.platform == "win32": + try: + # Use PowerShell to get max refresh rate across all controllers + cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\"" + out = subprocess.check_output(cmd, shell=True).decode().splitlines() + rates = [float(r.strip()) for r in out if r.strip().isdigit()] + if rates: fps_cap = max(rates) + except Exception: pass # Enable idling with monitor refresh rate to effectively cap FPS self.runner_params.fps_idling.enable_idling = True