Skip to content

[Feat] Add optional setting for using Option-clicking to open Always Hidden section#305

Open
gitmichaelqiu wants to merge 5 commits intostonerl:mainfrom
gitmichaelqiu:main
Open

[Feat] Add optional setting for using Option-clicking to open Always Hidden section#305
gitmichaelqiu wants to merge 5 commits intostonerl:mainfrom
gitmichaelqiu:main

Conversation

@gitmichaelqiu
Copy link

@gitmichaelqiu gitmichaelqiu commented Mar 19, 2026

What does this PR do?

Implement a setting (optional, default off) to open Always Hidden bar upon Option+clicking and hides the bar after double clicking, behaving similar to Ice.

PR Type

  • Bugfix
  • CI/CD related changes
  • Code style update (formatting, renaming)
  • Documentation
  • Feature
  • i18n/l10n (Translation/Localization)
  • Refactor
  • Performance improvement
  • Test addition or update
  • Other (please describe):

Does this PR introduce a breaking change?

  • Yes
  • No

What is the current behavior?

Thaw currently has a different Always Hidden bar opening logic to Ice.

  • In Thaw, click twice opens the Always Hidden bar; In Ice, it hides the bar
  • In Ice, Option + click opens the Always Hidden bar

Issue Number: N/A

What is the new behavior?

A new setting called "Use Option-click to open always hidden section" is added. When this is off, the bar behaves the same as before. If this is on, the bar will hide after a double-click; the Always Hidden bar will show when Option-clicked.

This would make the app more friendly to those just transitioned here from Ice.

Localization for this line is also added.

PR Checklist

  • I’ve built and run the app locally
  • I’ve checked for console errors or crashes
  • I've run relevant tests and they pass
  • I've added or updated tests (if applicable)
  • I've updated documentation as needed
  • I've verified localized strings work correctly (if i18n/l10n changes)

Other information

Screenshot 2026-03-19 at 18 15 34

The new setting is added in Advanced > Menu Bar Sections.

Summary by CodeRabbit

  • New Features

    • Added an Advanced Settings toggle to enable Option‑click to reveal the always‑hidden menu section.
  • Behavior Changes

    • Click handling updated: when the new setting is enabled, Option‑click toggles the always‑hidden section; when disabled, double‑click/open behavior remains unchanged and follows visibility rules.
  • Bug Fixes

    • Simplified menu section hiding logic for more consistent behavior across section types.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6c649cd-8ca3-4155-a5af-923b718db299

📥 Commits

Reviewing files that changed from the base of the PR and between fdffaf7 and 8d5a621.

📒 Files selected for processing (1)
  • Thaw/MenuBar/ControlItem/ControlItem.swift
✅ Files skipped from review due to trivial changes (1)
  • Thaw/MenuBar/ControlItem/ControlItem.swift

📝 Walkthrough

Walkthrough

Adds a new Advanced setting useOptionClickToShowAlwaysHiddenSection (with persistence and UI toggle) and updates menu-bar control logic: ControlItem now captures appState for option-click handling, and MenuBarSection.hide() unconditionally sets all sections to hidden.

Changes

Cohort / File(s) Summary
Settings Defaults & Model
Thaw/Utilities/Defaults.swift, Thaw/Settings/Models/AdvancedSettings.swift
Introduce Defaults.DefaultValue.useOptionClickToShowAlwaysHiddenSection = false, add Defaults.Key.useOptionClickToShowAlwaysHiddenSection, and add @Published var useOptionClickToShowAlwaysHiddenSection with persistence observers.
Settings UI
Thaw/Settings/SettingsPanes/AdvancedSettingsPane.swift
Add a toggle bound to settings.useOptionClickToShowAlwaysHiddenSection in the "Menu Bar Sections" advanced settings pane.
Control flow / Click handling
Thaw/MenuBar/ControlItem/ControlItem.swift
Refactor performAction() to unwrap appState directly, capture appState in the Task, and branch double-click vs. Option-click behavior using appState.settings.advanced.useOptionClickToShowAlwaysHiddenSection.
Section hide behavior
Thaw/MenuBar/MenuBarSection.swift
Simplify hide() to unconditionally iterate menuBarManager.sections, set desiredState = .hideSection, and call updateControlItemState(for: nil) for each section (removed prior conditional branching).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant ControlItem
participant AppState
participant MenuBarManager
participant MenuBarSection

User->>ControlItem: click / double-click / option-click
ControlItem->>AppState: read settings (useOptionClick...)
alt Option-click && setting enabled
    ControlItem->>MenuBarManager: request toggle `.alwaysHidden` section
    MenuBarManager->>MenuBarSection: set `.desiredState = visible` / updateControlItemState
else Normal double-click or other
    ControlItem->>MenuBarManager: standard show/hide flow
    MenuBarManager->>MenuBarSection: set `.desiredState` accordingly
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A gentle Option-tap I bring,
To coax a secret section to spring,
Settings saved, a toggle true,
Clicks now know what they should do,
Hippity-hop — a small feature sings.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main feature being added—an optional setting for Option-clicking to open the Always Hidden section.
Description check ✅ Passed The PR description comprehensively covers the change: what was done, PR type, current vs. new behavior, checklist confirmation, and includes visual documentation of the new setting.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Thaw/MenuBar/ControlItem/ControlItem.swift (1)

577-583: ⚠️ Potential issue | 🟠 Major

Gate Option-click by setting, and open (not toggle) the Always Hidden section.

Lines 577-583 currently apply Option-click behavior unconditionally and call toggle(). That conflicts with the feature contract: Option-click should only apply when enabled, and it should open the Always Hidden section.

🔧 Proposed fix
-                if
-                    modifierFlags == .option,
-                    let section = menuBarManager.section(withName: .alwaysHidden),
-                    section.isEnabled
-                {
-                    section.toggle()
-                    return
-                }
+                if
+                    appState.settings.advanced.useOptionClickToShowAlwaysHiddenSection,
+                    modifierFlags == .option,
+                    let section = menuBarManager.section(withName: .alwaysHidden),
+                    section.isEnabled
+                {
+                    section.show()
+                    return
+                }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Thaw/MenuBar/ControlItem/ControlItem.swift` around lines 577 - 583, Gate the
Option-click behavior behind the appropriate user setting and call open()
instead of toggle() on the Always Hidden section: replace the unconditional
check that looks at modifierFlags == .option and then toggles the section with a
conditional that also checks the Option-click enabled preference (e.g.,
Preferences.shared.optionClickOpensAlwaysHidden or the existing setting used
elsewhere in the code), and when allowed call section.open() on
menuBarManager.section(withName: .alwaysHidden) after verifying
section.isEnabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@Thaw/MenuBar/ControlItem/ControlItem.swift`:
- Around line 577-583: Gate the Option-click behavior behind the appropriate
user setting and call open() instead of toggle() on the Always Hidden section:
replace the unconditional check that looks at modifierFlags == .option and then
toggles the section with a conditional that also checks the Option-click enabled
preference (e.g., Preferences.shared.optionClickOpensAlwaysHidden or the
existing setting used elsewhere in the code), and when allowed call
section.open() on menuBarManager.section(withName: .alwaysHidden) after
verifying section.isEnabled.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c863e53-29f9-4ebd-a074-f3ef374560a1

📥 Commits

Reviewing files that changed from the base of the PR and between 6f274b3 and fdffaf7.

📒 Files selected for processing (6)
  • Thaw/MenuBar/ControlItem/ControlItem.swift
  • Thaw/MenuBar/MenuBarSection.swift
  • Thaw/Resources/Localizable.xcstrings
  • Thaw/Settings/Models/AdvancedSettings.swift
  • Thaw/Settings/SettingsPanes/AdvancedSettingsPane.swift
  • Thaw/Utilities/Defaults.swift

@sonarqubecloud
Copy link

@gitmichaelqiu
Copy link
Author

I made an update for CodeRabbit's suggeston. Check if the Option-Click setting is on when detecting Option-click.

@stonerl
Copy link
Owner

stonerl commented Mar 19, 2026

Thank you. Since we have a feature freeze for UI changes, I will review and merge this for the 1.3 development cycle.

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