Skip to content

feat: add toggle to show/hide menu bar icon#1

Open
Karl-Dai wants to merge 11 commits into
ilikebug:mainfrom
Karl-Dai:feat/menu-bar-icon-toggle
Open

feat: add toggle to show/hide menu bar icon#1
Karl-Dai wants to merge 11 commits into
ilikebug:mainfrom
Karl-Dai:feat/menu-bar-icon-toggle

Conversation

@Karl-Dai
Copy link
Copy Markdown

@Karl-Dai Karl-Dai commented May 7, 2026

Summary

  • Adds a "Show Menu Bar Icon" toggle in Settings → General (default on), persisted in SQLite alongside other settings.
  • When the icon is hidden, global shortcuts (cmd+shift+v, F1, F3) continue to work; re-launching the app opens Preferences via DistributedNotificationCenter signaling between the second-launch and running instance.
  • Cold-start fallback: if the icon is hidden and the app starts fresh, Settings opens automatically once AppSettings finishes its async DB load (deterministic poll on a new isLoaded signal, 5s timeout).

Architecture notes

  • Replaced WindowGroup(id: "settings") with the standard SwiftUI Settings { … } scene so Settings can be opened from AppDelegate via NSApp.sendAction(Selector(("showSettingsWindow:"))) regardless of whether the window is currently alive.
  • MenuBarExtra uses isInserted: $settings.showMenuBarIcon for live show/hide.
  • Notification name com.antigravity.veloxclip.openSettings; observer body wrapped in Task { @MainActor in … } for Swift 6 strict-concurrency correctness.

Files changed

  • VeloxClip/Models/AppSettings.swiftshowMenuBarIcon property + isLoaded signal + DB persistence.
  • VeloxClip/Views/SettingsView.swift — toggle in General section.
  • VeloxClip/App/VeloxClipApp.swift — Settings scene, MenuBarExtra binding, distributed-notification post + observer, cold-start fallback.
  • docs/superpowers/specs/2026-05-07-menu-bar-icon-toggle-design.md — design.
  • docs/superpowers/plans/2026-05-07-menu-bar-icon-toggle.md — implementation plan (incl. documented refinement vs. spec).

Test plan

This repo has no automated test target (VeloxClipTests declaration in Package.swift is a stub; no Tests/ directory exists). Manual verification per the spec checklist:

  • Fresh install → menu bar icon visible.
  • Toggle off → icon disappears immediately; cmd+shift+v / F1 / F3 still work.
  • With icon hidden, double-click VeloxClip.app → Settings opens, app activates.
  • With icon hidden, cmd+Q then re-launch from Spotlight → Settings opens automatically (cold-start fallback).
  • Toggle back on while Settings is open → icon reappears immediately.
  • Reboot macOS, launch app → toggle state persists.
  • With icon visible and Settings closed, double-click VeloxClip.app → Settings still opens (verifies the duplicate-launch signal path).

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.

1 participant