Commit Graph
2 Commits
Author SHA1 Message Date
yetone 1d7eac3125 gui: every installed magpie on a config is one at a time, so a Mac restart can't put two birds in the menu bar (inaction on Discord) — the lock that keeps a second magpie from running (v0.1.879) was keyed by the config dir and the resolved executable, so two copies of the app each took their own: Open at login starting the copy it was turned on for while the Mac reopened the one last run (another magpie.app, or one run translocated from Downloads, whose path changes each launch), or Homebrew's, whose path has its version in it. Every magpie.app and Homebrew copy now shares the lock; a bare binary elsewhere (the owner's magpie-dev) still has its own. A second launch for the window opens the app by its bundle id (com.yetone.magpie) rather than its own path, so it reaches the running copy. TestOneMagpieAtATime fails without the change (the translocated and Homebrew copies had locks of their own). go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn and TestUserPath timed out under load and pass alone). 2026-10-05 16:59:33 +08:00
yetone e8eb8005f3 gui: one magpie at a time on the Mac, so one started at login twice (its own open at login and a Login Item the user added, or the Mac reopening it after a shutdown it wasn't quit for) ends instead of putting a second bird in the menu bar (Crispin on Discord) — Wails has no single instance on the Mac, and magpie's LaunchAgent runs the binary itself, past the Mac's one-copy-of-an-app, so both starts ran: the second found the gateway served and only watched it, with its own tray icon. A magpie now takes a flock in its config dir, keyed by the config dir and its resolved executable (a sandboxed HOME, and a copy elsewhere such as the owner's magpie-dev, each run on their own); a second one that finds it held ends: a start at login quietly, one for the window or the panel opens the .app, which has the running magpie show its window (the Dock's reopen; at most once in 10 s, so it can't go on), and a magpie:// link is opened, which the Mac hands to the running one. The system lets a flock go when its holder ends however it ends, so a shutdown leaves nothing held behind. Restart to update relaunches only once the old process has gone, so it is unaffected. TestOneMagpieAtATime (a second process holds the lock, this one is refused, the holder is killed, the lock is free) fails on the old code. Two GUI launches on the real Mac weren't tried, since a GUI magpie registers its magpie:// handler with the system. go vet, builds (darwin gui and nogui, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-04 23:43:34 +08:00