Skip to content

Add macOS menu bar game controls#19

Merged
austin-smith merged 4 commits intomainfrom
macos-menu-bar-enhancements
Feb 23, 2026
Merged

Add macOS menu bar game controls#19
austin-smith merged 4 commits intomainfrom
macos-menu-bar-enhancements

Conversation

@austin-smith
Copy link
Copy Markdown
Owner

  • Add game controls to the macOS menu bar: New Game, Redeal, Undo, Auto Finish, Hint, and Statistics.
  • Connect menu bar actions to the active game scene so labels and enabled states stay in sync with current game state.

Introduce a GameCommand enum and a .gameCommand Notification.Name; add a new "Game" CommandMenu in the app that posts these notifications (New Game, Redeal, Undo, Auto Finish, Hint) with keyboard shortcuts. Update ContentView to observe .gameCommand notifications and handle them via a new handleGameCommand(_:) method that maps commands to existing UI actions (start/redeal/undo/auto-finish/hint). Also refactor applyObservers to chain command and game-state observers while preserving lifecycle and draw-mode change handling.
Replace the NotificationCenter-based game commands with a macOS Commands implementation using FocusedValues. Added GameMenuCommands.swift that defines GameMenuActions and GameMenuState and provides a Game CommandMenu with proper enable/disable logic and keyboard shortcuts. Removed the GameCommand enum and related notification names (openStatistics, gameCommand) from CommandNotifications. ComputerSolitaireApp now uses GameMenuCommands() instead of the inline CommandMenu. ContentView no longer listens for game/statistics notifications; it exposes focusedSceneValue entries for gameMenuActions and gameMenuState and supplies computed action/state wrappers to wire up menu behavior.
Rework the toolbar implementation for macOS in ContentView: wrap the view with .toolbar consistently, introduce ToolbarSpacer(.flexible) and .fixed spacers, convert individual ToolbarItem placements into ToolbarItemGroup(.primaryAction), and simplify button declarations to use Label with .labelStyle for consistent icon+title presentation. The hint button is now conditionally included inside the group and redundant ToolbarItem wrappers were removed to tidy up layout and improve alignment/appearance.
@austin-smith austin-smith linked an issue Feb 23, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e07a05c103

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@austin-smith
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@austin-smith austin-smith merged commit bd93827 into main Feb 23, 2026
2 checks passed
@austin-smith austin-smith deleted the macos-menu-bar-enhancements branch February 23, 2026 08:36
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.

Add menu bar functions for macOS

1 participant