From v0.1.1354 a restart to update hands the gateway over, and the old
magpie hides its own menu bar item with Wails' Hide, which is
[statusItem setVisible:NO]. AppKit keeps that in the app's defaults by
the item's autosave name ("NSStatusItem VisibleCC Item-0" = 0 on macOS
26), and the next item made under that name starts hidden. So after the
update the icon was gone, and quitting and reopening didn't bring it
back (Mitsuha on v0.1.1364; audie on two Macs, macOS 27.0.1).
Evidence: a 30-line Cocoa probe made a status item, setVisible:NO, and
every later launch of the same program started with visible=0 and the
key = 0; removeStatusItem kept nothing; removing the key brought it back
on the next launch. This machine's com.yetone.magpie.sbhandover.plist
(the handover commit's own sandbox run) holds
"NSStatusItem VisibleCC Item-0" => false.
Fix (internal/gui/trayshown_darwin.go, app.go):
- leaveMenuBar (was the onHandedOver closure) queues forgetTrayHidden
on the main thread after Wails' hide block, so the hide is made on
screen but not kept.
- bringTrayBack, once per computer (a flag in the Mac's defaults, never
in a WebDAV backup), forgets a kept hide before the tray is made: that
repairs everyone an older magpie already hit. A hide kept after that
is the user's and is left alone.
- A magpie handed over to by an older one (which still hides for good)
forgets the hide once that pid has quit and shows its item, unless a
hide was already kept when it started.
docs/subsystems/gui-shell.md says so under the handover.
Run (worktree at origin/main ed91aa04e):
- TestHandoverLeavesTheMenuBarIconForTheNextMagpie (AppKit child with a
real Wails tray, CFFIXED_USER_HOME sandbox): ok, -count=3.
- Broken by hand: leaveMenuBar without forgetTrayHiddenLater -> "handing
over kept the menu bar icon hidden for the next magpie (1 kept)";
bringTrayBack without forgetTrayHidden -> "the icon an older magpie hid
wasn't brought back (still hidden true, 1 kept)".
- go test ./internal/gui/ -count=1: ok 86.7s; go test -tags nogui
./internal/gui/: ok 67.2s.
- gofmt -l: nothing. go vet ./internal/gui/ (darwin), GOOS=linux go vet
-tags nogui, GOOS=windows go vet: ok. go build, GOOS=linux go build
-tags nogui, GOOS=windows go build: ok.
- No GUI asset changed, so no Playwright run.
Not tried: a real signed update from v0.1.1367 to this build on the
user's bundle id; whether Control Center hides the new version's running
item live when the old one writes the key (the probe's running item kept
visible=1; the on-screen window list needs screen recording rights). Not
run: the full go test ./... (one package touched; other sessions are
queued for the suite). audie's WebDAV sync carries no tray setting and
doesn't restart magpie; the icon going there is taken to be the same
update's restart, not confirmed with them.