Skip to content

Add Windows accessibility handler (partial #17)#38

Open
chicken602 wants to merge 2 commits intoGeneralUserModels:mainfrom
chicken602:main
Open

Add Windows accessibility handler (partial #17)#38
chicken602 wants to merge 2 commits intoGeneralUserModels:mainfrom
chicken602:main

Conversation

@chicken602
Copy link
Copy Markdown

Adds Windows support for the accessibility handler. Covers the Windows portion of #17 — Linux is not included.

Changes

  • Refactored accessibility.py into a platform-abstracted base class (AccessibilityHandlerBase) with _accessibility_mac.py and _accessibility_windows.py as subclasses
  • Existing macOS behavior preserved — code moved to _accessibility_mac.py, no logic changes
  • Platform detection + re-export at bottom of accessibility.py so downstream imports are unchanged
  • Unsupported platforms raise OSError

Windows implementation

  • UI Automation via comtypes (ElementFromPoint, GetFocusedElement, ControlViewWalker for parent info)
  • UIA property extraction: Name, ControlType, AutomationId, IsEnabled, HasKeyboardFocus, etc.
  • COM initialized/uninitialized per __call__ for thread safety
  • _has_useful_info uses UIA-native property names and control type IDs
  • comtypes added as Windows-only dep in pyproject.toml

Other fixes

  • Signal handler registration wrapped in try/except ValueError for Windows thread compatibility
  • DPI awareness set at startup for coordinate consistency across mss/pynput/screeninfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant