Co-authored-by: Ian Fan <ianfan0@gmail.com>
Co-authored-by: Nathan Schulte <nmschulte@gmail.com>
Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
This removes any pending messages once the item is destroyed.
Furthermore, this installs SNI event calbacks asynchronously
in order to prevent sd-bus from bypassing pending messages.
In case a tray icon cannot be found or does not have a desirable size,
swaybar retries the search again and again, which increases load on disk
and CPU. This commit solves it by storing target_size for each icon, so
that swaybar does not search for an icon of some size if it already tried to.
Fixes#3789.