Skip to content

let your agent control your phone

background: scroll via momentum flicks (wheel events don't route unfocused)

ShawnPanabac478575ced
diff --git a/src/phone_harness/background.py b/src/phone_harness/background.py
index 94ccc74..633acbe 100644
--- a/src/phone_harness/background.py
+++ b/src/phone_harness/background.py
@@ -176,9 +176,27 @@ def drag(x1, y1, x2, y2, duration=0.35, steps=14):
def scroll_wheel(dy, x, y, steps=6):
- """No hardware wheel reaches the phone — a scroll is a finger drag.
- Positive dy scrolls content up (finger moves up), matching mirror's sign."""
- drag(x, y, x, y - dy, duration=0.25)
+ """Scroll with a fast momentum FLICK, not a wheel event.
+
+ iPhone Mirroring scrolls by translating Mac scroll-wheel events, but those
+ only reach the app when it is active — so in the background they do nothing
+ (verified: 0% movement). A slow touch-drag also barely moves an iOS list.
+ A *fast* flick does: it hands the scroll view enough release velocity to
+ carry the list (verified ~29% frame change per flick, new rows each time).
+
+ Sign matches the wheel path it replaces: dy < 0 flicks the finger up so
+ content scrolls up and reveals what's below (scroll_screen's "up")."""
+ pid, win = _ctx()
+ if dy < 0: # reveal content below
+ y0, y1 = win["y"] + win["h"] * 0.72, win["y"] + win["h"] * 0.28
+ else: # reveal content above
+ y0, y1 = win["y"] + win["h"] * 0.28, win["y"] + win["h"] * 0.72
+ _emit(_LMOUSE_DOWN, x, y0, pid, win)
+ for i in range(1, steps + 1):
+ t = i / steps
+ _emit(_LMOUSE_DRAGGED, x, y0 + (y1 - y0) * t, pid, win)
+ time.sleep(0.006) # fast — velocity is what carries it
+ _emit(_LMOUSE_UP, x, y1, pid, win)
# --- keyboard (background), via make-key + CGEventPostToPid ---