kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 128 forks source link

isMinimized and unMinimize incorrect #269

Closed lukesmurray closed 3 years ago

lukesmurray commented 3 years ago

Reproduced with slack, zoom, roam research, vscode.

To reproduce minimize an app then use a keyboard shortcut to query whether the app isMinimized and try to unminimize it.

lukesmurray commented 3 years ago

If it's applicable I used app.mainWindow()

kasper commented 3 years ago

Thanks! Just to confirm understanding, what was the actual result and expected behaviour?

lukesmurray commented 3 years ago

After I minimize a window with the yellow minimize button I expect isMinimized to return true. Instead it returns false. Similarly if a window is minimized I expect unMinimize to return true. Instead it returns false. I ran into this issue because when you try to position or resize a minimized window you get a null reference error. I tried to unMinimize the window before positioning but since both isMinimized and unMinimize aren't working as expected I can't position or resize minimized windows.

lukesmurray commented 3 years ago

If isMinimize is working on your machine it's possible this has to do with customizations I've done to my dock in which case I'll need to investigate a bit more.

lukesmurray commented 3 years ago

Also thank you for this library. I know I've reported a couple of bugs but overall this is absolutely fantastic and a joy to work with. 🚀

kasper commented 3 years ago

@lukesmurray Thanks for the details, I’ll look into this when I have time. These just make it even better. Thanks for the kind words!

kasper commented 3 years ago

@lukesmurray Hey, thanks for reporting this! This was partly expected behaviour and a bug at the same time. Long story short, a minimised app will not have a main window and this is why you experienced this behaviour. The App#mainWindow() now correctly returns undefined in such cases.

You should use App#windows() instead if you want to have this toggling behaviour, since it will always contain even minimised windows. Hope this helps!