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.72k stars 326 forks source link

Make sure a system tray exists before hiding ourselves #493

Closed guihkx closed 1 year ago

guihkx commented 1 year ago

Some Linux desktop environments (e.g. GNOME) don't support system tray icons natively, so let's make sure a system tray exists before we try to hide our window, otherwise users won't be able to quit the app.

guihkx commented 1 year ago

This was first noticed by @nuttyartist in https://github.com/nuttyartist/notes/pull/492#issuecomment-1439978645 while he was testing in elementaryOS 5.

nuttyartist commented 1 year ago

Well, if system tray doesn't exist maybe we shouldn't support/show the Menu Action at all? I think that way is better.

nuttyartist commented 1 year ago

Although as a note, the PR does work for me on Elementary OS 5 Qt5.

bjorn commented 1 year ago

Well, if system tray doesn't exist maybe we shouldn't support/show the Menu Action at all? I think that way is better.

I thought the same thing, though at least on Linux the system tray can become available or disappear while the app is running. The documentation notes:

If the system tray is currently unavailable but becomes available later, QSystemTrayIcon will automatically add an entry in the system tray if it is visible.

Unfortunately there appears to be no signal provided so we could know when the system tray becomes available. I'm not sure if it would be alright to just check the availability on startup.

nuttyartist commented 1 year ago

Oh ok, then. Let's keep it as it is.

guihkx commented 1 year ago

Thanks for testing :)

Merging...