aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray/watcher.c
AgeCommit message (Collapse)AuthorLines
2025-01-07Use has_prefix() instead of strncmp() throughoutSimon Ser-3/+3
This is safer than hardcoded string lengths.
2024-11-10swaybar: Emit property changes for SNI watcherJoan Bruguera Micó-0/+12
Emit property change signals for the IsStatusNotifierHostRegistered and RegisteredStatusNotifierItems properties in StatusNotifierWatcher, so code relying on the PropertiesChanged signal, instead of signals such as StatusNotifierHostRegistered, can work properly. A library that is affected by this is the libappindicator-gtk3* library and it can cause tray icons to be missing after starting swaybar due to a race condition, as follows: * An application using libappindicator-gtk3 starts, e.g. nm-applet. * Some time later, swaybar starts. * swaybar creates the StatusNotifierWatcher. * libappindicator-gtk3 observes the new watcher, but it sees that IsStatusNotifierHostRegistered=false, so it falls back to the Freedesktop System tray protocol. * swaybar creates the StatusNotifierHost. At this point, libappindicator-gtk3 should "un-fallback" back to SNI. However, since swaybar does not emit the PropertiesChange signal on IsStatusNotifierHostRegistered, libappindicator-gtk3 doesn't get notified, and stays in fallback state forever. * As a result, nm-applet will not show in the swaybar tray. This race can be made reliable by inserting a 1-second long sleep here: https://github.com/swaywm/sway/blob/03483ff3707a358d935e451d39748e58c205ce8a/swaybar/tray/tray.c#L57 (*) Note that the libappindicator-gtk3 library has been mostly replaced by libayatana-appindicator, which is not affected by this. The affected version is still used by Arch Linux, source code at: https://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk/files/298
2024-02-23Define _POSIX_C_SOURCE globallySimon Ser-1/+0
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2023-06-23swaybar: remove the argument of StatusNotifierHostRegisteredHodong-1/+1
According to https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierWatcher/ there is no argument for the StatusNotifierHostRegistered signal.
2023-04-14Use format_str() throughoutSimon Ser-6/+3
2020-03-30tray: track SNI callbacksIan Fan-1/+7
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.
2019-02-16tray: fix memory leaksIan Fan-2/+2
2019-02-16tray: when a service is lost, remove all matching itemsIan Fan-13/+14
Before, only the first matching item would be removed, which could leave stale items.
2019-01-21swaybar: fix setting floating watcher slotsIan Fan-2/+2
2019-01-21Replace wlr_log with sway_logM Stoeckl-13/+13
This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
2018-12-31swaybar: add StatusNotifierWatcher to trayIan Fan-0/+212