Skip to content
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

OS X: Minimization into dock icon #573

Open
balayanr opened this issue Nov 1, 2018 · 7 comments
Open

OS X: Minimization into dock icon #573

balayanr opened this issue Nov 1, 2018 · 7 comments

Comments

@balayanr
Copy link

balayanr commented Nov 1, 2018

I have minimization into icon turned on on my Mac and when I minimize the app, it's not shown in the list of existing windows.
image
Clicking "Show All Windows" on the icon shows that there are no available windows, but the minimized window appears in the bar for recent files.
image

@balayanr balayanr changed the title OS X: Minimization into dock icon breaks the app OS X: Minimization into dock icon makes the window disappear completely Nov 1, 2018
@balayanr balayanr changed the title OS X: Minimization into dock icon makes the window disappear completely OS X: Minimization into dock icon Nov 1, 2018
@almarklein
Copy link
Member

Thanks for reporting this!

This looks similar: https://stackoverflow.com/questions/35591319/restore-minimized-app-osx-dock-click-event-pyqt-pyinstaller

Is this the same as a "system tray icon"? If so, this might also be relevant: https://doc.qt.io/qt-5.11/qtwidgets-desktop-systray-example.html

@balayanr
Copy link
Author

balayanr commented Nov 2, 2018

The first link does talk about a similar problem (when the "minimization into icon" is turned off, it creates document-looking windows in the dock when you minimize).

The system tray solution is a bit strange, wondering if other QT-based apps have this problem. Keeping a system tray icon for something that doesn't really need to be there doesn't sound like a good idea, especially since you can't hide those on Mac.

@almarklein
Copy link
Member

Keeping a system tray icon for something that doesn't really need to be there doesn't sound like a good idea

I agree. I thought that it was maybe related. Good to hear that its not.

Any idea for a solution? I cannot imagine Pyzo being the first Qt app encountering this problem.

@balayanr
Copy link
Author

balayanr commented Nov 5, 2018

I am not familiar with Qt, but from some googling it looks like for Mac "hide" and "minimize" mean different things (the former literally hides the window, the latter actually minimizes it, https://forum.qt.io/topic/10204/minimize-application-to-dock-icon, https://stackoverflow.com/questions/44286102/minimize-to-tray-on-macosx).
I am not exactly sure how it's implemented in pyzo, but that would be a thing to check.
One a solution would be to list the window and/or open files in the app menu in the dock, there is a platform-specific function handling that (http://doc.qt.io/archives/qt-4.8/exportedfunctions.html). Then, when a file or the icon is clicked, forcefully "unminimize" the window. (https://stackoverflow.com/questions/15143369/qt-on-os-x-how-to-detect-clicking-the-app-dock-icon)

I would look into the documentation on window-related functions, maybe there's a note mentioning unusual behaviour on MacOS.

@almarklein
Copy link
Member

To get an idea of the urgency of this issue, what are the exact implications? Are you able to re-open Pyzo after it's minimized?

@balayanr
Copy link
Author

balayanr commented Nov 6, 2018

Until I realized that the window appears in the list when clicking "Show all windows" I was sure that pyzo just broke every time I minimized it, because clicking on the icon didn't do anything. For years I just assumed people know about this issue and it was gonna get fixed eventually, but I guess there are not that many people with this system setting turned on. Or nobody bothered to report it, just like me.

Now that I know that there is a way to find the window it's not so bad. If the fix is really tough I wouldn't put it on top of priorities, but I think capturing the icon click and forcefully un-maximizing the window should do the trick.
Listing the open files/windows in the dock menu (right click on the icon, like on the screenshots below) would be a nice addition, so that there was a way to un-minimize and have the needed file open, but it's fine either way.
image
image

Thanks for taking a look at this issue

@almarklein
Copy link
Member

I asked because this would need some extra work, involving me getting my hands on a mac :) I will have a look sometime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants