cotabby
cotabby copied to clipboard
Event-driven focus via AXObservers (replace 200ms poll)
FocusTracker.swift polls via a Timer(timeInterval: pollInterval, repeats: true) around ~200ms. That costs battery and delays focus acquisition. Switch to AXObserverAddNotification for AXFocusedUIElementChanged, AXFocusedWindowChanged, AXValueChanged, AXSelectedTextChanged, AXUIElementDestroyed, AXApplicationDeactivated. Keep polling behind a fallback flag for apps that don't fire notifications reliably.
Acceptance
- [ ] Focus changes propagate via AXObserver notifications without polling in the happy path.
- [ ] Automatic fallback to polling for apps where observer install fails or fires inconsistently.
- [ ] Idle CPU measured and compared against current baseline.
- [ ] Existing focus-snapshot tests still pass.
Parent: #16