Previously, the applet subscribed to layout updates for all items immediately
upon registration (eager-loading). This caused severe issues with applications
like VLC, which fail to respond to `com.canonical.dbusmenu.GetLayout` calls
during high-load operations (e.g., initializing video playback).
These unanswered calls resulted in DBus timeouts that:
1. Flooded the connection queue.
2. Blocked the processing of other signals (like `Unregistered`).
3. Caused the applet to become unresponsive and the icon to persist (ghosting).
This patch modifies the subscription logic to only subscribe to layout updates
when the specific menu is actually open. This "lazy-loading" approach:
- Prevents hitting applications with DBus calls during vulnerable states.
- Drastically reduces unnecessary DBus traffic.
This allows the applet to be restarted on panel configuration changes
without replacing the daemon, or having races between different applet
instances trying to run the watcher.
Otherwise, this should behave similarly to the existing version.
Should fix https://github.com/pop-os/cosmic-panel/issues/284.
The comment that was previously here assumed that `ItemIsMenu` should be
defined for any status item that has a menu, but the FreeDesktop spec
rather defines it as an item that "only supports the context menu", so
we should open the menu instead of trying to call `Activate`.
This change won't affect behavior if `ItemIsMenu` is true, but `Activate`
errors, except by opening the menu without having to wait for that
errror first. It will fix the left click to open menu behavior if any
client defines that method to not error, but does set `ItemIsMenu`.
This was added in https://github.com/pop-os/cosmic-applets/pull/1143,
but I don't think this code will ever be reached? This code is called
when activating an item in a menu, so it should only apply when there is
a menu.
We should use a more complicated method to lookup the icon from the
theme, but `cosmic-freedesktop-icons` will need some changes to be able
to accomodate a custom theme path.
This is probably an improvement. Anything that uses `IconThemePath`
is likely not working currently, so it won't make things worse.
Fixes issue where `fcitx5` app icon persists after it is no longer
running. It seems it was getting a `NameOwnerChanged` event with the
acquired name after `register_status_notifier_item()`.
When running desktop-file-validate:
```
/builddir/build/BUILD/cosmic-applets-1.0.0_alpha.6_git20250408.2573eb7-build/BUILDROOT/usr/share/applications/com.system76.CosmicAppletStatusArea.desktop: error: file contains multiple keys named "Name[pt]" in group "Desktop Entry"
```
Fixes building for Fedora, as we use desktop-file-validate for checking desktop files.
Ref: 2573eb7545
I figured since this is the translation that was recently added, that the intent is to keep the newer one.