Skip to content

Settings → Presence: choose Dock icon / menu bar / both / neither - #33

Merged
trsdn merged 2 commits into
mainfrom
app-presence-setting
Sep 22, 2026
Merged

trsdn merged 2 commits into
mainfrom
app-presence-setting

Conversation

@trsdn

@trsdn trsdn commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Closes #32.

What

  • AppPresence (OpenPromptrCore): dockAndMenuBar (default, today's fixed behavior) / dockOnly / menuBarOnly / backgroundOnly, stored as two independent facts (showsDockIcon, showsMenuBarItem) and persisted in AppSettings (backward compatible: missing key decodes to the default).
  • AppModel.setPresence(_:) persists it, following the setEnableLocalAPI pattern.
  • AppDelegate subscribes to model.$presence and applies NSApplication.setActivationPolicy plus creates/discards AppStatusItemController (now removes its own status item in deinit, since a removed NSStatusItem can't be brought back).
  • New Presence section in the Settings window (a Picker, plus the current choice's explanation).
  • README section explaining the four choices and that output control and the recovery path (reopening the app) are unaffected by all of them.

Design notes

  • No new mechanism for "get back to a hidden app": applicationShouldHandleReopen already exists and already reopens the control window; this makes it the load-bearing recovery path for menuBarOnly/backgroundOnly instead of an incidental one.
  • applicationDidFinishLaunching still defaults to .regular before the model exists, corrected moments later once configure() subscribes — same brief-Dock-icon-flash tradeoff a fully event-free launch would need a bigger restructuring to avoid; noted as a known limitation.

Verified

swift build, swift test (64, +5 new), swift format lint --strict, ./build-app.sh + --version, and the UI snapshot renderer (Settings window shows the new section correctly in light/dark).

Not verified

The app was not run. Everything AppKit-level here — activation policy actually hiding/showing the Dock icon, the status item actually appearing/disappearing at runtime, applicationShouldHandleReopen actually reopening the window in each mode, Cmd-Tab visibility — needs a real run, which swift test cannot exercise (OpenPromptrCoreTests only covers the AppPresence/AppSettings logic).

🤖 Generated with Claude Code

trsdn and others added 2 commits September 22, 2026 20:55
AppPresence (OpenPromptrCore) stores the choice as two independent facts —
shows a Dock icon, shows a menu bar item — persisted in AppSettings, default
Dock and menu bar (today's fixed behavior, unchanged for existing users).
AppDelegate observes AppModel.$presence and applies it: activation policy
(.regular/.accessory) and creating/discarding AppStatusItemController, which
now removes its own status item on deinit. The existing
applicationShouldHandleReopen already reopens the control window, which is
what makes 'neither' recoverable without a Dock icon or menu bar item.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EGjbE4ZXFZyXFd2GQ7xRAp
Scripts/make-icon.swift now also renders Resources/MenuBarIcon.png: the same
'T over a mirror line' mark as the Dock icon, without the reflection (too
faint to survive scaling to menu bar size) or the background plate, as a
template image so macOS recolors it for light/dark/highlighted. build-app.sh
copies it into the bundle; AppStatusItemController loads it with a fallback
to the old SF Symbol for a bare 'swift build' executable with no Resources.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EGjbE4ZXFZyXFd2GQ7xRAp
@trsdn
trsdn merged commit f3f0a9a into main Sep 22, 2026
10 checks passed
@trsdn
trsdn deleted the app-presence-setting branch September 22, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let the user choose Dock icon vs. menu bar vs. background-only presence

1 participant