-
Notifications
You must be signed in to change notification settings - Fork 808
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
Show/Hide Menubar and Dock Icon on macOS #3014
Conversation
724557b
to
22f4da1
Compare
a48cc3f
to
5986cd7
Compare
By the way, what is the |
I should also emphasize that the weird structure of |
5986cd7
to
086ed51
Compare
This is still ready for review… |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
9f91c62
to
6b230f5
Compare
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.
Super nice 🙂 thanks a ton!
6b230f5
to
9ae0287
Compare
Signed-off-by: Elsie Hupp <[email protected]>
9ae0287
to
0ad55e8
Compare
/backport to stable-3.14 |
AppImage file: nextcloud-PR-3014-0ad55e82c7baa2400f7425d8011a17baf5374304-x86_64.AppImage |
Quality Gate passedIssues Measures |
Branched from #2959.
This pull request adds code to make it so that the onboarding wizard and the settings dialogue both behave like foreground windows on macOS. When either window opens, the application spawns a dock icon and displays a menubar, and when the window is closed, the dock icon despawns, and the menubar is replaced with whatever other application is now in the foreground.
On Linux (or, at least GNOME), this behavior is automatically implemented when the
Qt::Window
flag is used. The behavior is especially important on macOS, because aQt::Window
can be maximized, but without a menubar, the application is unable to show the titlebar containing the “stoplight” buttons, so it is very difficult to un-maximize it. (The dock icon and menubar are a package deal in Cocoa, so you can’t have one without the other. While the dock icon isn’t as immediately necessary as the menubar on macOS, implementing a temporary dock icon on macOS has the added benefit of being consistent with the existing behavior on Linux.) The fact that theQt::Window
flag does not implement this behavior on macOS by default should probably be rightly considered a bug in Qt, but I digress.I was unable to get a working copy of Windows installed on my computer, so I was unable to test whether the behavior of
Qt::Window
on Windows is more like Linux or more like macOS. The way theForegroundBackground
class I created is structured makes it easy to add a Windows implementation after the fact, and indeed my original intention was to include implementations for multiple different platforms in this pull request.Ultimately, because the behavior did not require a custom implementation on Linux (or, at least GNOME), and because I was unable to set up a Windows development environment, I decided to make this pull request solely include the macOS implementation. I also haven’t been able to test the behavior on KDE or any other Linux shells aside from GNOME, but there aren’t any other open issues about the existing behavior of the application’s dock icon, so further shell-specific implementations can also safely wait.
It’s worth noting that the onboarding wizard already uses the
Qt::Window
flag, so the changes I’ve made here fix the existing issues of it being difficult to exit fullscreen and it being difficult to quit the application from this wizard. This pull request is a prerequisite for adding theQt::Window
flag to the settings dialogue, because it would have the same issues that already exist for the onboarding wizard.There may be other places where it would be desirable for Nextcloud to temporarily spawn a dock icon and a menubar, but like the possible Windows and non-GNOME Linux implementations, I feel like they can be safely deferred to a later pull request.