fix(flowext): a locked screen wedges the rig; and open location opened the wrong browser
1. LOCKED SCREEN. With CGSSessionScreenIsLocked=Yes, every AppleScript window/tab query hangs ~2 min and returns -1712 "AppleEvent timed out". This is NOT a browser bug — with m3ultra locked, `count of windows` hung identically for Chrome, Brave, Finder AND System Events, while app-level properties (name/version/running) answered instantly. launch.sh now checks the lock first and exits 0 with an instruction, so the 10-min tick retries instead of leaving two osascript processes wedged. 2. `open location "$URL"` is Standard Additions: it hands the URL to the DEFAULT browser, never to $BROWSER. m3ultra's default is Brave while the extension lives in Chrome, so the fresh-open path would have opened the wrong browser entirely. Now makes the tab inside the target app. 3. Wrapped the tell block in `with timeout of 30 seconds` so a wedged app can't hold the job. Verified: detector reports unlocked on ultra / LOCKED on m3ultra; after the fix m3ultra logs the instruction and exits with no hung osascript, ultra still logs "focused on Flow". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
be2478c8dc
commit
2236a96ed4
22
launch.sh
22
launch.sh
@ -37,8 +37,22 @@ fi
|
||||
#
|
||||
# Must name the browser the EXTENSION is loaded into. ultra = Brave, m3ultra = Chrome.
|
||||
BROWSER="${FLOW_BROWSER:-Brave Browser}"
|
||||
|
||||
# A LOCKED SCREEN wedges every AppleScript window/tab query for ~2 min, then -1712
|
||||
# "AppleEvent timed out". Not a browser bug: with the screen locked, Finder, System Events
|
||||
# and Brave all hang on `count of windows` identically. Bail out loudly instead.
|
||||
if ioreg -n Root -d1 -r | tr -d ' ' | grep -q '"CGSSessionScreenIsLocked"=Yes'; then
|
||||
echo "screen is LOCKED on $(hostname -s) — cannot drive $BROWSER (every window query would" \
|
||||
"hang, then -1712). Unlock it; for an unattended rig also set System Settings >" \
|
||||
"Lock Screen > 'Require password after screen saver begins' = Never."
|
||||
exit 0 # not an error: the 10-min tick retries once someone unlocks
|
||||
fi
|
||||
|
||||
# `open location` hands the URL to the DEFAULT browser (Brave here) — never to $BROWSER.
|
||||
# Make the tab inside the target app instead. Timeout so a wedged app can't hold the job.
|
||||
osascript <<OSA
|
||||
tell application "$BROWSER"
|
||||
with timeout of 30 seconds
|
||||
tell application "$BROWSER"
|
||||
set found to false
|
||||
repeat with w in windows
|
||||
set i to 0
|
||||
@ -53,8 +67,10 @@ tell application "$BROWSER"
|
||||
end repeat
|
||||
if not found then
|
||||
activate
|
||||
open location "$URL"
|
||||
if (count of windows) = 0 then make new window
|
||||
tell window 1 to make new tab with properties {URL:"$URL"}
|
||||
end if
|
||||
end tell
|
||||
end tell
|
||||
end timeout
|
||||
OSA
|
||||
echo "$BROWSER focused on Flow. With Auto-start ticked, the rinse begins on load."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user