Open on startup by default and block duplicate workspace names

- LoginItem registers on the first bundled launch, so the app opens on
  startup without the user finding the toggle; a user who turns it off is
  never overridden. A never-registered bundle reports SMAppService .notFound
  rather than .notRegistered, so the guard only treats enabled/approval as
  done. --diag now prints the raw status.
- New Workspace refuses a name that already exists (case-insensitive) and
  says so inline; Return cannot bypass it. The composer's '# Name' still
  switches to the existing workspace, which is the quick-capture gesture.
This commit is contained in:
2026-10-26 20:46:02 +08:00
parent e0c47ad010
commit 15a2aa92f7
3 changed files with 57 additions and 5 deletions
+9 -2
View File
@@ -13,8 +13,10 @@ clicking an item copies it back to the clipboard.
`NSStatusItem Preferred Position Prompt`). Left click toggles the panel,
right click shows the menu (accessibility state, launch at login, open data
folder, quit). Contains the single-instance guard and `LoginItem`
(`SMAppService`). The sync panel also carries a Launch at Login toggle (the
app's only settings surface). Also sets `NSApp.mainMenu` with Hide Panel (Cmd+W) and Quit
(`SMAppService`): the app auto-registers as a login item on the first
bundled launch (once, tracked by `loginItem.autoRegistered` in UserDefaults)
so it opens on startup by default; the Launch at Login toggle in the sync
panel (the app's only settings surface) is the opt-out. Also sets `NSApp.mainMenu` with Hide Panel (Cmd+W) and Quit
(Cmd+Q) — an accessory app shows no menu bar, but the main menu still
services key equivalents, which is the only way to quit from the keyboard
while the panel has focus. `applicationShouldHandleReopen` shows the panel so
@@ -239,6 +241,11 @@ brew upgrade --cask prompt
populated when the command fires.
- `captureSelection()` blocks up to 0.5s polling the pasteboard — keep it off
the main thread (the hotkey handler already dispatches to a global queue).
- **`SMAppService.mainApp.status` is `.notFound` for a bundle BTM has never
seen**, not `.notRegistered`, and `register()` still works from that state.
Only treat `.enabled` and `.requiresApproval` as "already done"; checking for
`.notRegistered` silently skips the registration. `Prompt --diag` prints the
raw status.
- The double-Shift tap needs Accessibility; without it the event tap silently
fails and only the Carbon fallbacks work. The panel banner and the status
menu both surface the permission state, and `AppDelegate` shows a launch