feat: per-window detection — only flash windows needing attention

Detector now walks each AXWindow subtree independently and returns
both aggregate signals (for state machine) and a list of AXWindow
element refs for windows with active approval signals.

Overlay reads position/size directly from AXWindow elements via
AXValueGetValue, eliminating the CGWindowList dependency (which
returned empty names for Electron windows anyway).

Daemon passes only the active AXWindow refs to the overlay, so
only the specific window(s) waiting for user input get flashed.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-10 02:54:15 -04:00
parent bce6ec39f8
commit b31f39268e
5 changed files with 152 additions and 78 deletions

View File

@@ -2,6 +2,7 @@ import pytest
from unittest.mock import patch, MagicMock
from cursor_flasher.detector import (
CursorDetector,
PollResult,
parse_ui_signals,
UISignals,
)
@@ -68,5 +69,13 @@ class TestCursorDetector:
def test_returns_none_when_cursor_not_running(self):
detector = CursorDetector()
with patch.object(detector, "_find_cursor_pid", return_value=None):
signals = detector.poll()
assert signals is None
result = detector.poll()
assert result is None
class TestPollResult:
def test_default_has_empty_active_windows(self):
result = PollResult(signals=UISignals())
assert result.active_windows == []
assert result.signals.agent_working is False
assert result.signals.approval_needed is False