diff --git a/main.py b/main.py index bb2f83d..cdd8548 100644 --- a/main.py +++ b/main.py @@ -80,6 +80,21 @@ try: except: pass +# Detect Windows "Reduce Motion" preference +try: + import ctypes + SPI_GETCLIENTAREAANIMATION = 0x1042 + animation_enabled = ctypes.c_bool(True) + ctypes.windll.user32.SystemParametersInfoW( + SPI_GETCLIENTAREAANIMATION, 0, + ctypes.byref(animation_enabled), 0 + ) + if not animation_enabled.value: + ConfigManager().data["reduce_motion"] = True + ConfigManager().save() +except Exception: + pass + # Configure Logging class QmlLoggingHandler(logging.Handler, QObject): sig_log = Signal(str) diff --git a/src/core/config.py b/src/core/config.py index 0779685..c365d1e 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -58,7 +58,10 @@ DEFAULT_SETTINGS = { # Low VRAM Mode - "unload_models_after_use": False # If True, models are unloaded immediately to free VRAM + "unload_models_after_use": False, # If True, models are unloaded immediately to free VRAM + + # Accessibility + "reduce_motion": False # Disable animations for WCAG 2.3.3 } class ConfigManager: diff --git a/src/ui/bridge.py b/src/ui/bridge.py index 073327a..42f5d24 100644 --- a/src/ui/bridge.py +++ b/src/ui/bridge.py @@ -111,6 +111,7 @@ class UIBridge(QObject): settingChanged = Signal(str, 'QVariant') modelStatesChanged = Signal() # Notify UI to re-check isModelDownloaded llmDownloadRequested = Signal() + reduceMotionChanged = Signal(bool) def __init__(self, parent=None): super().__init__(parent) @@ -130,6 +131,7 @@ class UIBridge(QObject): self._app_vram_mb = 0.0 self._app_vram_percent = 0.0 self._is_destroyed = False + self._reduce_motion = bool(ConfigManager().get("reduce_motion")) # Start QThread Stats Worker self.stats_worker = StatsWorker() @@ -277,6 +279,8 @@ class UIBridge(QObject): ConfigManager().set(key, value) if key == "ui_scale": self.uiScale = float(value) + if key == "reduce_motion": + self.reduceMotion = bool(value) self.settingChanged.emit(key, value) # Notify listeners (e.g. Overlay) @Property(float, notify=uiScaleChanged) @@ -288,6 +292,15 @@ class UIBridge(QObject): self._ui_scale = val self.uiScaleChanged.emit(val) + @Property(bool, notify=reduceMotionChanged) + def reduceMotion(self): return self._reduce_motion + + @reduceMotion.setter + def reduceMotion(self, val): + if self._reduce_motion != val: + self._reduce_motion = val + self.reduceMotionChanged.emit(val) + @Property(float, notify=appCpuChanged) def appCpu(self): return self._app_cpu