-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Conversation
There was a problem hiding this 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
NSAppreferences withNSApplication.shared - Introduced a new
showInDockDefaults key and UI toggle - Hooked up a task in
Settings.swiftto change the app’s activation policy based onshowInDock
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 NSApp → NSApplication.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)
| NSApplication.shared.setActivationPolicy(.accessory) | ||
| } |
There was a problem hiding this comment.
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.
| NSApplication.shared.setActivationPolicy(.accessory) | |
| } | |
| if !Defaults[.showInDock] { | |
| NSApplication.shared.setActivationPolicy(.accessory) | |
| } |
This option is enabled by default, as it makes sense to display the Dock icon when the settings window is open.
Closes #827