Skip to content

Add menubar popover mode with window option#176

Draft
nwoodfine wants to merge 3 commits intosuperhighfives:mainfrom
nwoodfine:menubar-popover
Draft

Add menubar popover mode with window option#176
nwoodfine wants to merge 3 commits intosuperhighfives:mainfrom
nwoodfine:menubar-popover

Conversation

@nwoodfine
Copy link
Copy Markdown

@nwoodfine nwoodfine commented Mar 1, 2026

Addresses #181

Replaces the menu bar menu window with a native SwiftUI MenuBarExtra that shows the full Pika interface in a popover. The new popover mode is made default (maybe I've been presumptuous that users will prefer this!), but there's an Open as window preference in General Settings that lets users revert to traditional window behavior.

new-color-history-palettes

Window mode is still the default behavior when dock is enabled (instead of menu bar). Also fixed made some small style fixes for the color format dropdown in window mode.

Stacked PR: This builds on #177 (Color History) and #178 (Custom Palettes). The diff currently includes commits from those PRs—please review and merge PRs 1 & 2 first, then I'll rebase so only PR 3 changes remain.

This is PR 3 of 3 in a stacked series:

  1. Color History (Add persistent color history bar #177) → base: main
  2. Custom Color Palettes (Add custom color palette library with iCloud sync #178) → base: main (depends on PR 1)
  3. Menubar Popover Mode (this PR) → base: main (depends on PRs 1 & 2)

Changes (this PR only)

  • PikaApp: New @main SwiftUI App entry point with MenuBarExtra (.window style)
  • PopoverContentView: Explicit frame sizing for popover content with dynamic height
  • AppDelegate: Removed @main, NSMenuDelegate, and old status bar system (NSStatusItem + NSMenu). Added setupStatusItem() for "open as window" mode, isMenubarMode computed property, preference observers
  • Eyedroppers: start() now checks isMenubarMode to skip hide/show behavior in popover context
  • PreferencesView: Added "Open as window" toggle (visible in menubar mode only)
  • NavigationMenu: Padding adjustments for popover layout
  • PikaWindow: Updated initial window size to 480×230
  • System color picker activation fix: NSApp.activate(ignoringOtherApps: true) before showing panel, required for MenuBarExtra context where app runs with .accessory activation policy
  • Minor README fixes (Xcode version note, typo, markdown formatting)

New files

  • Pika/PikaApp.swift

Testing

  • Built and tested with Xcode 26.3 on macOS 26.3

Test plan

  • In menubar mode: click status icon → popover shows full interface
  • Pick colors from popover — eyedropper and system picker both work
  • Toggle "Open as window" in Preferences — should switch to window mode
  • Verify "Hide menu bar icon" still works correctly
  • Verify dock mode is unaffected
  • Verify popover height adjusts with history/palettes
  • Verify system color picker opens correctly from popover context

Note on dependencies

These changes were developed and tested with locally updated dependencies. The PRs intentionally do not include these dependency bumps — they remain on the versions currently in main. The features should not require the newer versions to build or run. For reference, the development environment used:

Dependency main version Dev/test version
SwiftLint (Mintfile) 0.52.4 0.57.1
SwiftFormat (Mintfile) 0.55.1 0.55.5
KeyboardShortcuts (SPM) 2.3.0 2.4.0
Sparkle (SPM) revision 891afd44c707 2.9.0

@nwoodfine nwoodfine force-pushed the menubar-popover branch 2 times, most recently from afd2141 to 18b757f Compare March 1, 2026 07:59
nwoodfine added 3 commits March 1, 2026 15:49
Addresses superhighfives#139

Adds a color history bar below the footer showing recently picked colors.
Tapping a swatch applies it as the foreground and copies to clipboard.

- ColorHistoryManager: MRU list with immediate and debounced recording
- SwatchBar: Reusable swatch component (shared with future palette feature)
- Refactored system color picker to use togglePicker() directly
- Dynamic window resizing when history appears/disappears
Adds user-defined color palettes in a text format with support for all
color formats (hex, rgb, hsl, hsb, lab, oklch). Palettes appear as
swatch bars below color history and sync via iCloud Key-Value Store.

- PaletteParser: INI-style [Name] headers with comma-separated colors
- NSColor.fromColorString(): Reverse parsing for all supported formats
- PaletteSyncManager: Bidirectional iCloud KVS sync with loop prevention
- PaletteEditor: Monospaced text input with validation feedback
- Up to 5 palettes, 20 colors each
Replaces the status bar menu with a native SwiftUI MenuBarExtra that
shows the full Pika interface in a popover. "Open as window" preference
lets users revert to traditional window behavior in menubar mode.

- PikaApp: @main SwiftUI App with MenuBarExtra (.window style)
- PopoverContentView: Explicit frame sizing for popover content
- Simplified status item management for hybrid popover/window mode
- System color picker activation fix for MenuBarExtra context
@superhighfives
Copy link
Copy Markdown
Owner

I've refactored a lot of the app, so I think I'd need to rethink how the PR works, but I'd love to understand the use case here. Is the popover preferable to having a window? Did you find any rough edges? Can take a pass a this one too, just curious to understand more of the rationale between docked and menu-bar-free-floating.

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.

2 participants