nuttyartist / notes

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

Linux: Fix Wayland window associations #598

Closed ReillyBrogan closed 11 months ago

ReillyBrogan commented 11 months ago

Wayland compositors use the desktopFileName window property to associate native Wayland windows with their .desktop launcher.

This was previously set to "notes" when qt launched as a native Wayland window (the default in Wayland sessions), which could cause various inconsistencies.

Notably, KDE Plasma would display the generic Wayland icon in task view for Notes instead of the icon referenced in the .desktop file.

Fix this by propagating the APP_ID property (which is used to name the .desktop file during packaging) to main.cpp so that we can call setDesktopFileName with it.

After this change KDE Plasma correctly displays the Notes icon in task view.

Before: image

After: image

ReillyBrogan commented 11 months ago

Note that I have no experience with cmake or QT, so this solution may not be particularly idiomatic or clean. This should work for Flatpak but I have no idea how to test that.

I tested the following configurations after making this change and all worked as expected:

ReillyBrogan commented 11 months ago

Lint issues should be fixed now

ReillyBrogan commented 11 months ago

Note that this also fixes an issue with the native window frame. Before on Plasma it would display the generic Wayland icon in the top left, now it displays the Notes icon. This wasn't an issue on GNOME because GNOME Wayland reads the StartupWMClass property from the .desktop file and uses that to match windows as well (which is technically non-conformant with the Freedesktop/Wayland specs but GNOME devs do whatever they want to do).

You can see this in the screenshots in this comment: https://github.com/nuttyartist/notes/issues/347#issuecomment-1427598576

nuttyartist commented 11 months ago

Awesome! thanks, @ReillyBrogan! Let's wait for @guihkx to test on his end as well before merging (:

guihkx commented 11 months ago

Thanks!