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()`.
It seems status icons, at least some, don't send property change
notifications. So we can't rely on that, and have to disable caching.
And handle the `NewIcon` signal defined in
https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem
I'm not sure whether or not there's a *good* reason it works this way,
but regardless I see `nm-applet` and `ibus` update their icons as
they should after these changes.
Comments in `gnome-shell-extension-appindicator` indicate this is
necessary for some clients. Checking the return value doesn't seem to
be.
There are more comments about Dropbox; more may be needed to fix it,
which doesn't seem to behave very properly.
If this has the wrong type, it causes a parse error due to
https://github.com/dbus2/zbus/issues/856.
This fixes the status icon for Slack, and probably other applications.
Not sure how this field is defined in general, but with Slack it is
an `aas`.
`gnome-shell-extension-appindicator` doesn't seem to use the `shortcut`
field either.