From 65501f0e467efa5e5b5ac01ef098971489b2b8c9 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Mon, 9 Mar 2020 11:09:25 +0000 Subject: tray: track SNI callbacks 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. --- swaybar/tray/watcher.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'swaybar/tray/watcher.c') diff --git a/swaybar/tray/watcher.c b/swaybar/tray/watcher.c index 951a0589..16afc27c 100644 --- a/swaybar/tray/watcher.c +++ b/swaybar/tray/watcher.c @@ -182,7 +182,13 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) { ret = sd_bus_request_name(bus, watcher->interface, 0); if (ret < 0) { - sway_log(SWAY_ERROR, "Failed to acquire service name: %s", strerror(-ret)); + if (-ret == EEXIST) { + sway_log(SWAY_DEBUG, "Failed to acquire service name '%s':" + "another tray is already running", watcher->interface); + } else { + sway_log(SWAY_ERROR, "Failed to acquire service name '%s': %s", + watcher->interface, strerror(-ret)); + } goto error; } -- cgit v1.2.3-54-g00ecf