nuttyartist / notes

Fast and beautiful note-taking app written in C++. Write down your thoughts.
https://notes-foss.com
Mozilla Public License 2.0
3.77k stars 333 forks source link

macOS: Always 'close' ourselves to dock #478

Closed guihkx closed 1 year ago

guihkx commented 1 year ago

Bug 1:

Closing the window on macOS merely hides the app to the dock. However, because Qt is never informed of this, it will still think its window is visible when we try to restore it, requiring the user to click on the tray icon twice, for example.

We fix this by monitoring AppKit's hide / unhide notifications (events), and then we simply call Qt's hide() / show() methods, accordingly.

Fixes #458


Bug 2:

This is still related to bug 1: Clicking on the tray icon will call Qt's hide() / show() methods, but AppKit is also never informed of this.

So, we listen to Qt's showEvent / hideEvent and then we simply call AppKit's hide: / unhide: methods, accordingly.

Unfortunately, this does not seem to work every time, for some reason.

But I'd argue that's still better than not doing anything...🤷

guihkx commented 1 year ago

Sorry for the extra push, I had to make the comments I added a bit more accurate there.

nuttyartist commented 1 year ago

Alrighty. The system tray isn't very consistent yet, but it's ok for now.

I see that system tray is not default on macOS. What about other operating systems?

guihkx commented 1 year ago

I see that system tray is not default on macOS.

Well, technically there is a system tray icon on macOS, and it's enabled by default...

What we don't there have is a system tray context menu.

What about other operating systems?

On non-macOS, we have both a system tray icon and context menu.

nuttyartist commented 1 year ago

Oh okay, I probably had the settings off before testing already hah.

Thanks for the fixes, @guihkx!

guihkx commented 1 year ago

Thanks!

guihkx commented 1 year ago

I don't know how I messed up this badly, but these changes were merged.