Repository navigation
fix(analyzer): prefer the OS window owner over title parsing on macOS - #21
Conversation
_normalize() resolves the app name from the "<content> - <App>" title convention first (L1), then the OS process name (L2). That order fits Windows, where titles end with the app name and the process name is an exe like "chrome.exe". On macOS titles rarely end with the app name: Terminal's title is "dir — command — 120×30", so the app became "120×30"; a Chrome tab "ScreenMind — Your AI Memory, 100% Local" became the app. On macOS the window owner name from Quartz is ground truth, so use it first (still skipping generic wrappers). Title parsing remains the fallback when there is no owner name. Windows and Linux are unchanged. Existing reconciliation scenarios use Windows-style inputs, so they now pin sys.platform to win32; new macOS scenarios cover the darwin path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…app name Replace the sys.platform == "darwin" check in _normalize() with a property on the platform layer, following the platform_support pattern: - PlatformAdapter.trusts_os_app_name is False by default (Windows/Linux keep title-first resolution). - MacOSAdapter returns True: the window owner name is user-facing, while titles rarely end with the app name. - analyzer._os_app_name_is_trusted() reads it and treats any adapter error as "not trusted". Tests now patch that helper instead of sys.platform, and check the default/override on each adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A couple of minor cleanup suggestions, plus one dependency to consider:
The two are just minor cleanup; the main concern is making sure #20 and #21 are integrated together. |
Problem
_normalize()picks the app name in this order: the last part of the window title after-(L1), then the OS process name (L2). That works on Windows. There, titles end with the app name and the process name is an exe likechrome.exe.On macOS titles rarely end with the app name:
ScreenMind — llama-server ◂ python — 120×30(Terminal)120×30TerminalScreenMind — Your AI Memory, 100% Local(Chrome)Google ChromeThis only shows up once the window title is correct, so it pairs with the macOS frontmost-window fix (#20). The code doesn't depend on it, though.
Fix
Let the platform layer decide, following the
platform_supportpattern. New propertyPlatformAdapter.trusts_os_app_nameisFalseby default andTrueonMacOSAdapter. When it'sTrue,_normalize()uses the OS owner name first (still skipping generic wrappers likeelectron). Title parsing stays as the fallback when there is no owner name. Windows and Linux don't change, andanalyzer.pyhas nosys.platformcheck.Testing
test_app_reconciliation.pyuse Windows-style inputs, so they now forcetrusts_os_app_nameoff. Without this they fail on a Mac.TestReconcileAppNameMacOScovers the Terminal size suffix, owner beating the title, and the fallback with no owner.TestTrustsOsAppNamechecks the default on each adapter, and that the analyzer reads the adapter and treats errors as "not trusted".pytest tests/test_app_reconciliation.py tests/test_analyzer.py: 102 passed.🤖 Generated with Claude Code