-
Notifications
You must be signed in to change notification settings - Fork 800
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
macOS: Display Dock icon and use its context menu #2155
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That's the plan :) Now I've found a way to make it work so, detecting the change from the OS. Time to test it on an older macOS version and to integrate here 😼 |
Signed-off-by: Michael Schuster <[email protected]>
… focus Add a timer to delay between calls to ownCloudGui::raiseDialog, to not annoy the users while they're switching to the Settings dialog. Signed-off-by: Michael Schuster <[email protected]>
Adopt upstream commit c5678f3 (owncloud/client#7868) Signed-off-by: Michael Schuster <[email protected]>
Use our fancy real app name. It is shown in different places, like the system's menu bar. Examples: - Menu: nextcloud -> Nextcloud - Finder: nextcloud.app -> Nextcloud Signed-off-by: Michael Schuster <[email protected]>
For macOS the icon is set in the MacOSXBundleInfo.plist file. Setting it later lead to Dock display errors, shortly drawing an opaque background while the icon is bouncing at app launch. Signed-off-by: Michael Schuster <[email protected]>
The native way on macOS for an app context menu is to add it to the Dock icon. A right-click on the Dock icon reveals the standard menu, e.g. featuring "Quit". This commit adds the "Open main dialog" and "Settings" actions to the Dock menu. Signed-off-by: Michael Schuster <[email protected]>
The system displays the menu bar on top of the screen while the app's Dock icon is visible and active. Every app has a standard menu with its name right beside the Apple-menu. Users expect the menu to have at least "Quit", "About" and "Preferences" in Mac apps. LegalNotice is shown for "About", other minor fixes for LegalNotice: - Ensure correct parenting in GeneralSettings (SettingsDialog) - Remove additional "Legal notice" label in UI widget (duplicate of windowTitle) Signed-off-by: Michael Schuster <[email protected]>
- Move the setActivationPolicy logic from SettingsDialog to ownCloudGui - Modify ownCloudGui::slotDialogVisibilityChanged to show or hide the Dock Icon, depending on having any visible dialogs Signed-off-by: Michael Schuster <[email protected]>
As there seems to be no officially documented way to query for the setting, let's monitor the user's config file, written by the system when the user toggles the option for a Dock Icon: ~/Library/Preferences/com.apple.dock.plist Instead of reading and parsing it everytime our dialogs change, use a FolderWatcher to monitor for changes and notify ownCloudGui by emitting keepInDockChanged. Signed-off-by: Michael Schuster <[email protected]>
Modify the DockWatcher singleton to track click events for the Dock Icon, emit dockIconClicked and connect it to ownCloudGui::slotOpenMainDialog. Signed-off-by: Michael Schuster <[email protected]>
Signed-off-by: Michael Schuster <[email protected]>
99a3f46
to
cb0b900
Compare
Is it really such a strong pre-requisite? Or can we live without all the dialogs being auto-raised? (slightly annoying I understand but that papercut has been there before can probably still wait a bit) |
@er-vin :
|
I hadn't noticed this pull request earlier. I actually figured out a way to show the dock icon and the application menu, and I incorporated that method into #2959 and #2974. Once one or the other of these pull requests are approved, all you need to do to call the methods is add |
Hi @misch7—I don’t know if you’ve been following my progress on #3014, but I figured out a way to automatically show and hide the dock icon and the menubar when certain window-like dialogues are opened or closed. While there is an argument for Nextcloud Desktop not having a dock icon most of the time, once #3014 is merged, it should be fairly straightforward to add conditionals and/or additional hooks that would be tied to a toggle in the user preferences so that the dock icon could be persistent rather than contextual. (If you wanted the dock icon to be able to entirely replace the menubar icon, that would probably take quite a bit more doing and would need additional work to create corresponding functionality on Windows and Linux.) Regardless, I’m definitely in favor of adding redundant functionality to the dock icon and menubar when they are in fact present. In particular the norm on macOS seems to be for basically every available action to be present in the menus, so that (a) the user can search through them in the “Help” menu, and (b) the menu items can display corresponding keyboard shortcuts. Menubars seem to be distinctly unfashionable on Windows and Linux (at least on GNOME), so it would probably make the most sense for anything put into the menus to be fully redundant with a widget elsewhere in the interface. This way the menus could be strictly Mac-only, or they could be toggled on and off on Windows and/or Linux (where the norm seems to be hiding the menubar unless the user taps Alt). I’d be happy to try and take a stab at the menubar and/or the persistent dock icon option myself, but if there’s any way I could help with your desired feature set, feel free to let me know! |
/rebase |
I am closing since there was no progress with the discussion and the code. |
Important:
#2197 needs to be merged first, then I can rebase this one.
macOS: Show the Dock icon when Settings or any other dialog is visible
This also allows the user to reach the window(s) using the Application Switcher (Command + Tab).
More:
Keep in Dock
option. This leaves the context menu intact while the icon is pinned to the Dock.Use the Systray context menu as the Dock menu
The native way on macOS for an app context menu is to add it to the Dock icon. A right-click on the Dock icon reveals the standard menu, e.g. featuring "Quit". This commit adds the "Open main dialog" and "Settings" actions to the Dock menu:
The system then automatically shows the app menu bar too (with system's fixed standard menu actions):
Other small improvements:
CFBundleName
toMacOSXBundleInfo.plist
to use our real app name (Finder and Menu bar)nextcloud -> Nextcloud
setWindowIcon
)LegalNotice
dialog:GeneralSettings
(SettingsDialog
)windowTitle
)FolderWatcherPrivate::startWatching
Continuation of #2136.