Skip to content

Add “Show in Dock” option in the General settings #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2025
Merged

Conversation

lujjjh
Copy link
Collaborator

@lujjjh lujjjh commented Jul 6, 2025

This option is enabled by default, as it makes sense to display the Dock icon when the settings window is open.

Closes #827

@lujjjh lujjjh requested a review from Copilot July 6, 2025 14:22
Copilot

This comment was marked as outdated.

@lujjjh lujjjh added the enhancement New feature or request label Jul 6, 2025
@lujjjh lujjjh requested a review from Copilot July 6, 2025 14:31
Copy link

@Copilot Copilot AI left a comment

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 adds a “Show in Dock” toggle to the General settings, enabling users to show or hide the Dock icon at runtime (default on).

  • Replaced deprecated NSApp references with NSApplication.shared
  • Introduced a new showInDock Defaults key and UI toggle
  • Hooked up a task in Settings.swift to change the app’s activation policy based on showInDock

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Utilities/Application.swift Swapped NSApp.terminate(nil) for NSApplication.shared.terminate(nil)
UI/StatusItem.swift Same NSAppNSApplication.shared update in quit handler
UI/Settings.swift Imported Defaults, added showInDock task to toggle activation policy, replaced NSApp usage
UI/GeneralSettings/GeneralSettings.swift Added @Default(.showInDock) and a new Toggle for “Show in Dock”
UI/Extensions/NSWindow.swift Swapped NSApp.activate for NSApplication.shared.activate
UI/AccessibilityPermissionWindow.swift Replaced NSApp.terminate(nil) with NSApplication.shared.terminate(nil)
DefaultsKeys.swift Defined new showInDock key with default value true
Comments suppressed due to low confidence (1)

LinearMouse/DefaultsKeys.swift:9

  • [nitpick] There are no tests covering the new showInDock key or its default behavior. Consider adding unit tests to ensure the default is correct and that toggling showInDock properly updates the application’s activation policy.
    static let showInDock = Key<Bool>("showInDock", default: true)

Comment on lines +47 to +48
NSApplication.shared.setActivationPolicy(.accessory)
}
Copy link
Preview

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

The final call to setActivationPolicy(.accessory) after the update loop will always hide the Dock icon when the Settings view closes, overriding the user’s preference. Consider removing this unconditional call or guarding it based on the current showInDock value.

Suggested change
NSApplication.shared.setActivationPolicy(.accessory)
}
if !Defaults[.showInDock] {
NSApplication.shared.setActivationPolicy(.accessory)
}

Copilot uses AI. Check for mistakes.

@lujjjh lujjjh merged commit 006a076 into main Jul 6, 2025
2 checks passed
@lujjjh lujjjh deleted the show-in-dock branch July 6, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dock Icon Request
1 participant