Skip to content

Backlog fixes: menu warnings, OKLCH formatting, Xcode settings, context menu shortcuts - #186

Merged
superhighfives merged 11 commits into
mainfrom
feature/backlog-fixes
Mar 11, 2026
Merged

Backlog fixes: menu warnings, OKLCH formatting, Xcode settings, context menu shortcuts#186
superhighfives merged 11 commits into
mainfrom
feature/backlog-fixes

Conversation

@superhighfives

Copy link
Copy Markdown
Owner

Summary

  • Fix NSMenu hierarchy warnings — replaced .prohibited activation policy with computed policy in applicationWillFinishLaunching so menus stay attached during launch
  • OKLCH/LAB trailing zero stripping — extracted CGFloat.strippedDecimalString(maxDecimalPlaces:) utility to CGFloat+Format.swift, applied to both toOklchString and toLabString (e.g. 0.50000.5, 0.00000)
  • Xcode: enable asset symbol extensions — added ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES to all targets
  • Status bar context menu — rebuilt with all keyboard shortcuts: Pick (⌘D/⇧⌘D), Copy (⌘C/⇧⌘C), System picker (⌘S/⇧⌘S), Swap (X), Preferences (⌘,), Quit (⌘Q)

Test plan

  • Launch app — no NSMenu internal inconsistency warnings in console
  • Verify OKLCH values for achromatic colors (grays) show 0 not 0.0000 for chroma
  • Verify OKLCH values for chromatic colors drop trailing zeros (e.g. 0.3 not 0.3000)
  • Right-click status bar icon — confirm all action items are present with correct shortcuts
  • All unit tests pass (CGFloatFormatTests, NSColorLabTests)

🤖 Generated with Claude Code

superhighfives and others added 2 commits March 10, 2026 13:52
…shortcut

- AppDelegate: use computed activation policy instead of .prohibited in
  applicationWillFinishLaunching to prevent NSMenu hierarchy warnings
- NSColor+Lab: reduce OKLCH chroma precision from 4 to 3 decimal places
- Xcode: enable ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS
- StatusBarController: add ⌘Q keyboard shortcut to Quit menu item

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t menu

- Extract CGFloat.strippedDecimalString(maxDecimalPlaces:) to shared
  utility (CGFloat+Format.swift), replacing private helper in NSColor+Lab
- Apply trailing-zero stripping to both toOklchString and toLabString
- Add CGFloatFormatTests unit tests for the new utility
- Add OKLCH-specific format tests for trailing zero behaviour
- Rebuild status bar context menu with all keyboard shortcuts:
  Pick (⌘D/⇧⌘D), Copy (⌘C/⇧⌘C), System picker (⌘S/⇧⌘S),
  Swap (X), Preferences (⌘,), Quit (⌘Q)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 10, 2026 21:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bundles several backlog fixes across app startup/menu behavior, color string formatting, Xcode build settings, and status bar context menu shortcuts.

Changes:

  • Adjusts activation policy during applicationWillFinishLaunching to avoid NSMenu hierarchy warnings during launch.
  • Introduces CGFloat.strippedDecimalString(maxDecimalPlaces:) and applies it to LAB/OKLCH formatting to strip trailing zeros.
  • Rebuilds the status bar context menu to include key equivalents for common actions; updates Xcode project settings to generate Swift asset symbol extensions; adds unit tests for the new formatting behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Pika/AppDelegate.swift Sets activation policy earlier in app lifecycle based on Defaults[.appMode].
Pika/Extensions/CGFloat+Format.swift Adds numeric formatting helper used by color formatting.
Pika/Extensions/NSColor+Lab.swift Switches LAB/OKLCH formatting to use stripped decimal strings.
Pika/Services/StatusBarController.swift Rebuilds status bar context menu with key equivalents.
PikaTests/CGFloatFormatTests.swift Adds unit tests covering the new CGFloat formatting helper.
PikaTests/NSColorLabTests.swift Adds OKLCH formatting tests focused on trailing-zero stripping.
Pika.xcodeproj/project.pbxproj Wires in new files and enables asset symbol extension generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread Pika/Extensions/CGFloat+Format.swift
Comment thread PikaTests/NSColorLabTests.swift
Comment thread Pika/Extensions/NSColor+Lab.swift
superhighfives and others added 3 commits March 10, 2026 18:56
- AppDelegate: remove setActivationPolicy from applicationWillFinishLaunching
  (setupAppMode in applicationDidFinishLaunching sets the correct policy);
  the early policy change was triggering NSMenu hierarchy consistency warnings
- NavigationMenuItems: add .keyboardShortcut() to all action buttons so
  shortcuts are visible in the in-app gear menu dropdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Menu warnings: restoring .prohibited in applicationWillFinishLaunching —
removing it didn't fix the warnings (macOS-internal NSMenu consistency
check fires during storyboard menu setup, not fixable at this level).

In-app keyboard shortcuts: reverting .keyboardShortcut() additions to
NavigationMenuItems — SwiftUI registers these as global commands, which
(1) requires two clicks for shortcuts to appear due to lazy evaluation,
and (2) removes items from the Dock's contextual menu. Both are known
SwiftUI on macOS limitations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…penGL float format

- Add `import Foundation` to CGFloat+Format.swift for String(format:)
- Normalize -0.0 to +0.0 in strippedDecimalString to avoid "-0" output
- Fix toOpenGLString to ensure float notation (0.0 not 0) via glFloat helper
- Convert Substring to String before calling components(separatedBy:) in tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@superhighfives

Copy link
Copy Markdown
Owner Author

Fixed all three review suggestions in e2323d8: added import Foundation to CGFloat+Format.swift, normalized -0.0 in strippedDecimalString to prevent -0 output, updated toOpenGLString with a glFloat helper that ensures float notation (0.0 not 0), and converted Substring to String before .components(separatedBy:) in the tests.

superhighfives and others added 6 commits March 10, 2026 19:27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace 3- and 4-member return tuples with named structs (RGBAComponents,
  HSBComponents, HSLComponents, XYZComponents, LabComponents, OklchComponents)
  to resolve large_tuple violations without affecting any call sites
- Remove redundant trailing_comma disable in Constants.swift (already globally
  disabled in .swiftlint.yml)
- Rename loop variable i to idx in ClosestVector.swift to remove identifier_name
  disable/enable block
- Add explanatory comments to remaining identifier_name and line_length disables
  that cannot be removed (mathematical single-letter names, unavoidably long strings)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
identifier_name:
- NSColor+Hex: rename x → value in roundToHex
- NSColor+Init: rename c → char, R/G/B → red/green/blue; targeted disable for
  r/g/b/a params (public API labels NSColor(r:g:b:a:) that cannot be renamed)
- NSColor+Luminance: rename v → val, c → component, L1/L2 → lum1/lum2

line_length:
- Break long SwiftUI call sites across lines in ColorPickOverlay, ComplianceToggleGroup,
  ComplianceButtons, KeyboardShortcutGrid, ContentView, Eyedroppers, ColorPickOverlayWindow

function_body_length:
- ColorPickOverlayWindow: extract makeInfoPanel, makeCrosshairPanel, positionPanels helpers

cyclomatic_complexity:
- URLSchemeHandler: delegate each URL action to private handleFormat/Pick/System/Copy methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…turn types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
String interpolation cannot span multiple lines in Swift. Removed the
unnecessary "\(...)" wrapper since Exporter.toText/toJSON already return String.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consistent comma spacing in lab unformatted style to match oklch. Move
closing parentheses to their own lines for multiline function calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@superhighfives
superhighfives merged commit 30fc7d8 into main Mar 11, 2026
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