aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/tray
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-20 13:51:12 -0500
committerLibravatar emersion <contact@emersion.fr>2019-01-21 12:59:42 +0100
commit1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch)
tree5c3f60e0219cb8b4a1b7cafb760a871661866e32 /swaybar/tray
parentLog libinput_config_status errors (diff)
downloadsway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.gz
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.zst
sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.zip
Replace wlr_log with sway_log
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.
Diffstat (limited to 'swaybar/tray')
-rw-r--r--swaybar/tray/host.c30
-rw-r--r--swaybar/tray/icon.c2
-rw-r--r--swaybar/tray/item.c40
-rw-r--r--swaybar/tray/tray.c10
-rw-r--r--swaybar/tray/watcher.c26
5 files changed, 54 insertions, 54 deletions
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c
index cc8dd188..215e1e72 100644
--- a/swaybar/tray/host.c
+++ b/swaybar/tray/host.c
@@ -21,7 +21,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
21static void add_sni(struct swaybar_tray *tray, char *id) { 21static void add_sni(struct swaybar_tray *tray, char *id) {
22 int idx = list_seq_find(tray->items, cmp_sni_id, id); 22 int idx = list_seq_find(tray->items, cmp_sni_id, id);
23 if (idx == -1) { 23 if (idx == -1) {
24 wlr_log(WLR_INFO, "Registering Status Notifier Item '%s'", id); 24 sway_log(SWAY_INFO, "Registering Status Notifier Item '%s'", id);
25 struct swaybar_sni *sni = create_sni(id, tray); 25 struct swaybar_sni *sni = create_sni(id, tray);
26 if (sni) { 26 if (sni) {
27 list_add(tray->items, sni); 27 list_add(tray->items, sni);
@@ -34,7 +34,7 @@ static int handle_sni_registered(sd_bus_message *msg, void *data,
34 char *id; 34 char *id;
35 int ret = sd_bus_message_read(msg, "s", &id); 35 int ret = sd_bus_message_read(msg, "s", &id);
36 if (ret < 0) { 36 if (ret < 0) {
37 wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); 37 sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
38 } 38 }
39 39
40 struct swaybar_tray *tray = data; 40 struct swaybar_tray *tray = data;
@@ -48,13 +48,13 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
48 char *id; 48 char *id;
49 int ret = sd_bus_message_read(msg, "s", &id); 49 int ret = sd_bus_message_read(msg, "s", &id);
50 if (ret < 0) { 50 if (ret < 0) {
51 wlr_log(WLR_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret)); 51 sway_log(SWAY_ERROR, "Failed to parse unregister SNI message: %s", strerror(-ret));
52 } 52 }
53 53
54 struct swaybar_tray *tray = data; 54 struct swaybar_tray *tray = data;
55 int idx = list_seq_find(tray->items, cmp_sni_id, id); 55 int idx = list_seq_find(tray->items, cmp_sni_id, id);
56 if (idx != -1) { 56 if (idx != -1) {
57 wlr_log(WLR_INFO, "Unregistering Status Notifier Item '%s'", id); 57 sway_log(SWAY_INFO, "Unregistering Status Notifier Item '%s'", id);
58 destroy_sni(tray->items->items[idx]); 58 destroy_sni(tray->items->items[idx]);
59 list_del(tray->items, idx); 59 list_del(tray->items, idx);
60 set_bar_dirty(tray->bar); 60 set_bar_dirty(tray->bar);
@@ -66,20 +66,20 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data,
66 sd_bus_error *error) { 66 sd_bus_error *error) {
67 if (sd_bus_message_is_method_error(msg, NULL)) { 67 if (sd_bus_message_is_method_error(msg, NULL)) {
68 sd_bus_error err = *sd_bus_message_get_error(msg); 68 sd_bus_error err = *sd_bus_message_get_error(msg);
69 wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", err.message); 69 sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message);
70 return -sd_bus_error_get_errno(&err); 70 return -sd_bus_error_get_errno(&err);
71 } 71 }
72 72
73 int ret = sd_bus_message_enter_container(msg, 'v', NULL); 73 int ret = sd_bus_message_enter_container(msg, 'v', NULL);
74 if (ret < 0) { 74 if (ret < 0) {
75 wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); 75 sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
76 return ret; 76 return ret;
77 } 77 }
78 78
79 char **ids; 79 char **ids;
80 ret = sd_bus_message_read_strv(msg, &ids); 80 ret = sd_bus_message_read_strv(msg, &ids);
81 if (ret < 0) { 81 if (ret < 0) {
82 wlr_log(WLR_ERROR, "Failed to read registered SNIs: %s", strerror(-ret)); 82 sway_log(SWAY_ERROR, "Failed to read registered SNIs: %s", strerror(-ret));
83 return ret; 83 return ret;
84 } 84 }
85 85
@@ -99,7 +99,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
99 host->watcher_interface, watcher_path, host->watcher_interface, 99 host->watcher_interface, watcher_path, host->watcher_interface,
100 "RegisterStatusNotifierHost", NULL, NULL, "s", host->service); 100 "RegisterStatusNotifierHost", NULL, NULL, "s", host->service);
101 if (ret < 0) { 101 if (ret < 0) {
102 wlr_log(WLR_ERROR, "Failed to send register call: %s", strerror(-ret)); 102 sway_log(SWAY_ERROR, "Failed to send register call: %s", strerror(-ret));
103 return false; 103 return false;
104 } 104 }
105 105
@@ -109,7 +109,7 @@ static bool register_to_watcher(struct swaybar_host *host) {
109 get_registered_snis_callback, host->tray, "ss", 109 get_registered_snis_callback, host->tray, "ss",
110 host->watcher_interface, "RegisteredStatusNotifierItems"); 110 host->watcher_interface, "RegisteredStatusNotifierItems");
111 if (ret < 0) { 111 if (ret < 0) {
112 wlr_log(WLR_ERROR, "Failed to get registered SNIs: %s", strerror(-ret)); 112 sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", strerror(-ret));
113 } 113 }
114 114
115 return ret >= 0; 115 return ret >= 0;
@@ -120,7 +120,7 @@ static int handle_new_watcher(sd_bus_message *msg,
120 char *service, *old_owner, *new_owner; 120 char *service, *old_owner, *new_owner;
121 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 121 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
122 if (ret < 0) { 122 if (ret < 0) {
123 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 123 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
124 return ret; 124 return ret;
125 } 125 }
126 126
@@ -148,7 +148,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
148 watcher_path, host->watcher_interface, 148 watcher_path, host->watcher_interface,
149 "StatusNotifierItemRegistered", handle_sni_registered, tray); 149 "StatusNotifierItemRegistered", handle_sni_registered, tray);
150 if (ret < 0) { 150 if (ret < 0) {
151 wlr_log(WLR_ERROR, "Failed to subscribe to registering events: %s", 151 sway_log(SWAY_ERROR, "Failed to subscribe to registering events: %s",
152 strerror(-ret)); 152 strerror(-ret));
153 goto error; 153 goto error;
154 } 154 }
@@ -156,7 +156,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
156 watcher_path, host->watcher_interface, 156 watcher_path, host->watcher_interface,
157 "StatusNotifierItemUnregistered", handle_sni_unregistered, tray); 157 "StatusNotifierItemUnregistered", handle_sni_unregistered, tray);
158 if (ret < 0) { 158 if (ret < 0) {
159 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 159 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
160 strerror(-ret)); 160 strerror(-ret));
161 goto error; 161 goto error;
162 } 162 }
@@ -165,7 +165,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
165 "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", 165 "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged",
166 handle_new_watcher, host); 166 handle_new_watcher, host);
167 if (ret < 0) { 167 if (ret < 0) {
168 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 168 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
169 strerror(-ret)); 169 strerror(-ret));
170 goto error; 170 goto error;
171 } 171 }
@@ -180,7 +180,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
180 snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid); 180 snprintf(host->service, service_len, "org.%s.StatusNotifierHost-%d", protocol, pid);
181 ret = sd_bus_request_name(tray->bus, host->service, 0); 181 ret = sd_bus_request_name(tray->bus, host->service, 0);
182 if (ret < 0) { 182 if (ret < 0) {
183 wlr_log(WLR_DEBUG, "Failed to acquire service name: %s", strerror(-ret)); 183 sway_log(SWAY_DEBUG, "Failed to acquire service name: %s", strerror(-ret));
184 goto error; 184 goto error;
185 } 185 }
186 186
@@ -193,7 +193,7 @@ bool init_host(struct swaybar_host *host, char *protocol,
193 sd_bus_slot_set_floating(unreg_slot, 1); 193 sd_bus_slot_set_floating(unreg_slot, 1);
194 sd_bus_slot_set_floating(watcher_slot, 1); 194 sd_bus_slot_set_floating(watcher_slot, 1);
195 195
196 wlr_log(WLR_DEBUG, "Registered %s", host->service); 196 sway_log(SWAY_DEBUG, "Registered %s", host->service);
197 return true; 197 return true;
198error: 198error:
199 sd_bus_slot_unref(reg_slot); 199 sd_bus_slot_unref(reg_slot);
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 15fda631..ed152be5 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -317,7 +317,7 @@ void init_themes(list_t **themes, list_t **basedirs) {
317 list_add(theme_names, theme->name); 317 list_add(theme_names, theme->name);
318 } 318 }
319 char *theme_list = join_list(theme_names, ", "); 319 char *theme_list = join_list(theme_names, ", ");
320 wlr_log(WLR_DEBUG, "Loaded themes: %s", theme_list); 320 sway_log(SWAY_DEBUG, "Loaded themes: %s", theme_list);
321 free(theme_list); 321 free(theme_list);
322 list_free(theme_names); 322 list_free(theme_names);
323} 323}
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c
index 9056331e..39d83b23 100644
--- a/swaybar/tray/item.c
+++ b/swaybar/tray/item.c
@@ -35,12 +35,12 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
35 const char *prop, list_t **dest) { 35 const char *prop, list_t **dest) {
36 int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)"); 36 int ret = sd_bus_message_enter_container(msg, 'a', "(iiay)");
37 if (ret < 0) { 37 if (ret < 0) {
38 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 38 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
39 return ret; 39 return ret;
40 } 40 }
41 41
42 if (sd_bus_message_at_end(msg, 0)) { 42 if (sd_bus_message_at_end(msg, 0)) {
43 wlr_log(WLR_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop); 43 sway_log(SWAY_DEBUG, "%s %s no. of icons = 0", sni->watcher_id, prop);
44 return ret; 44 return ret;
45 } 45 }
46 46
@@ -52,14 +52,14 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
52 while (!sd_bus_message_at_end(msg, 0)) { 52 while (!sd_bus_message_at_end(msg, 0)) {
53 ret = sd_bus_message_enter_container(msg, 'r', "iiay"); 53 ret = sd_bus_message_enter_container(msg, 'r', "iiay");
54 if (ret < 0) { 54 if (ret < 0) {
55 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 55 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
56 goto error; 56 goto error;
57 } 57 }
58 58
59 int size; 59 int size;
60 ret = sd_bus_message_read(msg, "ii", NULL, &size); 60 ret = sd_bus_message_read(msg, "ii", NULL, &size);
61 if (ret < 0) { 61 if (ret < 0) {
62 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 62 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
63 goto error; 63 goto error;
64 } 64 }
65 65
@@ -67,7 +67,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
67 size_t npixels; 67 size_t npixels;
68 ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels); 68 ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels);
69 if (ret < 0) { 69 if (ret < 0) {
70 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 70 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
71 goto error; 71 goto error;
72 } 72 }
73 73
@@ -81,7 +81,7 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
81 } 81 }
82 list_free_items_and_destroy(*dest); 82 list_free_items_and_destroy(*dest);
83 *dest = pixmaps; 83 *dest = pixmaps;
84 wlr_log(WLR_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop, 84 sway_log(SWAY_DEBUG, "%s %s no. of icons = %d", sni->watcher_id, prop,
85 pixmaps->length); 85 pixmaps->length);
86 86
87 return ret; 87 return ret;
@@ -107,7 +107,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
107 107
108 int ret; 108 int ret;
109 if (sd_bus_message_is_method_error(msg, NULL)) { 109 if (sd_bus_message_is_method_error(msg, NULL)) {
110 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, 110 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop,
111 sd_bus_message_get_error(msg)->message); 111 sd_bus_message_get_error(msg)->message);
112 ret = sd_bus_message_get_errno(msg); 112 ret = sd_bus_message_get_errno(msg);
113 goto cleanup; 113 goto cleanup;
@@ -115,7 +115,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
115 115
116 ret = sd_bus_message_enter_container(msg, 'v', type); 116 ret = sd_bus_message_enter_container(msg, 'v', type);
117 if (ret < 0) { 117 if (ret < 0) {
118 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 118 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
119 goto cleanup; 119 goto cleanup;
120 } 120 }
121 121
@@ -131,16 +131,16 @@ static int get_property_callback(sd_bus_message *msg, void *data,
131 131
132 ret = sd_bus_message_read(msg, type, dest); 132 ret = sd_bus_message_read(msg, type, dest);
133 if (ret < 0) { 133 if (ret < 0) {
134 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 134 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
135 goto cleanup; 135 goto cleanup;
136 } 136 }
137 137
138 if (*type == 's' || *type == 'o') { 138 if (*type == 's' || *type == 'o') {
139 char **str = dest; 139 char **str = dest;
140 *str = strdup(*str); 140 *str = strdup(*str);
141 wlr_log(WLR_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str); 141 sway_log(SWAY_DEBUG, "%s %s = '%s'", sni->watcher_id, prop, *str);
142 } else if (*type == 'b') { 142 } else if (*type == 'b') {
143 wlr_log(WLR_DEBUG, "%s %s = %s", sni->watcher_id, prop, 143 sway_log(SWAY_DEBUG, "%s %s = %s", sni->watcher_id, prop,
144 *(bool *)dest ? "true" : "false"); 144 *(bool *)dest ? "true" : "false");
145 } 145 }
146 } 146 }
@@ -165,7 +165,7 @@ static void sni_get_property_async(struct swaybar_sni *sni, const char *prop,
165 sni->path, "org.freedesktop.DBus.Properties", "Get", 165 sni->path, "org.freedesktop.DBus.Properties", "Get",
166 get_property_callback, data, "ss", sni->interface, prop); 166 get_property_callback, data, "ss", sni->interface, prop);
167 if (ret < 0) { 167 if (ret < 0) {
168 wlr_log(WLR_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); 168 sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
169 } 169 }
170} 170}
171 171
@@ -188,10 +188,10 @@ static int sni_check_msg_sender(struct swaybar_sni *sni, sd_bus_message *msg,
188 bool has_well_known_names = 188 bool has_well_known_names =
189 sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES; 189 sd_bus_creds_get_mask(sd_bus_message_get_creds(msg)) & SD_BUS_CREDS_WELL_KNOWN_NAMES;
190 if (sni->service[0] == ':' || has_well_known_names) { 190 if (sni->service[0] == ':' || has_well_known_names) {
191 wlr_log(WLR_DEBUG, "%s has new %s", sni->watcher_id, signal); 191 sway_log(SWAY_DEBUG, "%s has new %s", sni->watcher_id, signal);
192 return 1; 192 return 1;
193 } else { 193 } else {
194 wlr_log(WLR_DEBUG, "%s may have new %s", sni->watcher_id, signal); 194 sway_log(SWAY_DEBUG, "%s may have new %s", sni->watcher_id, signal);
195 return 0; 195 return 0;
196 } 196 }
197} 197}
@@ -218,12 +218,12 @@ static int handle_new_status(sd_bus_message *msg, void *data, sd_bus_error *erro
218 char *status; 218 char *status;
219 int r = sd_bus_message_read(msg, "s", &status); 219 int r = sd_bus_message_read(msg, "s", &status);
220 if (r < 0) { 220 if (r < 0) {
221 wlr_log(WLR_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret)); 221 sway_log(SWAY_ERROR, "%s new status error: %s", sni->watcher_id, strerror(-ret));
222 ret = r; 222 ret = r;
223 } else { 223 } else {
224 free(sni->status); 224 free(sni->status);
225 sni->status = strdup(status); 225 sni->status = strdup(status);
226 wlr_log(WLR_DEBUG, "%s has new status = '%s'", sni->watcher_id, status); 226 sway_log(SWAY_DEBUG, "%s has new status = '%s'", sni->watcher_id, status);
227 set_sni_dirty(sni); 227 set_sni_dirty(sni);
228 } 228 }
229 } else { 229 } else {
@@ -238,7 +238,7 @@ static void sni_match_signal(struct swaybar_sni *sni, sd_bus_slot **slot,
238 int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path, 238 int ret = sd_bus_match_signal(sni->tray->bus, slot, sni->service, sni->path,
239 sni->interface, signal, callback, sni); 239 sni->interface, signal, callback, sni);
240 if (ret < 0) { 240 if (ret < 0) {
241 wlr_log(WLR_ERROR, "Failed to subscribe to signal %s: %s", signal, 241 sway_log(SWAY_ERROR, "Failed to subscribe to signal %s: %s", signal,
242 strerror(-ret)); 242 strerror(-ret));
243 } 243 }
244} 244}
@@ -353,7 +353,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
353static enum hotspot_event_handling icon_hotspot_callback( 353static enum hotspot_event_handling icon_hotspot_callback(
354 struct swaybar_output *output, struct swaybar_hotspot *hotspot, 354 struct swaybar_output *output, struct swaybar_hotspot *hotspot,
355 int x, int y, uint32_t button, void *data) { 355 int x, int y, uint32_t button, void *data) {
356 wlr_log(WLR_DEBUG, "Clicked on %s", (char *)data); 356 sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data);
357 357
358 struct swaybar_tray *tray = output->bar->tray; 358 struct swaybar_tray *tray = output->bar->tray;
359 int idx = list_seq_find(tray->items, cmp_sni_id, data); 359 int idx = list_seq_find(tray->items, cmp_sni_id, data);
@@ -367,11 +367,11 @@ static enum hotspot_event_handling icon_hotspot_callback(
367 int global_y = output->output_y + (top_bar ? config->gaps.top + y: 367 int global_y = output->output_y + (top_bar ? config->gaps.top + y:
368 (int) output->output_height - config->gaps.bottom - y); 368 (int) output->output_height - config->gaps.bottom - y);
369 369
370 wlr_log(WLR_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y); 370 sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
371 handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event 371 handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event
372 return HOTSPOT_IGNORE; 372 return HOTSPOT_IGNORE;
373 } else { 373 } else {
374 wlr_log(WLR_DEBUG, "but it doesn't exist"); 374 sway_log(SWAY_DEBUG, "but it doesn't exist");
375 } 375 }
376 376
377 return HOTSPOT_PROCESS; 377 return HOTSPOT_PROCESS;
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index d5d0c84e..fcf8114f 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -17,7 +17,7 @@ static int handle_lost_watcher(sd_bus_message *msg,
17 char *service, *old_owner, *new_owner; 17 char *service, *old_owner, *new_owner;
18 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 18 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
19 if (ret < 0) { 19 if (ret < 0) {
20 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 20 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
21 return ret; 21 return ret;
22 } 22 }
23 23
@@ -34,12 +34,12 @@ static int handle_lost_watcher(sd_bus_message *msg,
34} 34}
35 35
36struct swaybar_tray *create_tray(struct swaybar *bar) { 36struct swaybar_tray *create_tray(struct swaybar *bar) {
37 wlr_log(WLR_DEBUG, "Initializing tray"); 37 sway_log(SWAY_DEBUG, "Initializing tray");
38 38
39 sd_bus *bus; 39 sd_bus *bus;
40 int ret = sd_bus_open_user(&bus); 40 int ret = sd_bus_open_user(&bus);
41 if (ret < 0) { 41 if (ret < 0) {
42 wlr_log(WLR_ERROR, "Failed to connect to user bus: %s", strerror(-ret)); 42 sway_log(SWAY_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
43 return NULL; 43 return NULL;
44 } 44 }
45 45
@@ -58,7 +58,7 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
58 "/org/freedesktop/DBus", "org.freedesktop.DBus", 58 "/org/freedesktop/DBus", "org.freedesktop.DBus",
59 "NameOwnerChanged", handle_lost_watcher, tray); 59 "NameOwnerChanged", handle_lost_watcher, tray);
60 if (ret < 0) { 60 if (ret < 0) {
61 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 61 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
62 strerror(-ret)); 62 strerror(-ret));
63 } 63 }
64 64
@@ -96,7 +96,7 @@ void tray_in(int fd, short mask, void *data) {
96 // This space intentionally left blank 96 // This space intentionally left blank
97 } 97 }
98 if (ret < 0) { 98 if (ret < 0) {
99 wlr_log(WLR_ERROR, "Failed to process bus: %s", strerror(-ret)); 99 sway_log(SWAY_ERROR, "Failed to process bus: %s", strerror(-ret));
100 } 100 }
101} 101}
102 102
diff --git a/swaybar/tray/watcher.c b/swaybar/tray/watcher.c
index 198c6c85..68052ed9 100644
--- a/swaybar/tray/watcher.c
+++ b/swaybar/tray/watcher.c
@@ -27,7 +27,7 @@ static int handle_lost_service(sd_bus_message *msg,
27 char *service, *old_owner, *new_owner; 27 char *service, *old_owner, *new_owner;
28 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner); 28 int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
29 if (ret < 0) { 29 if (ret < 0) {
30 wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret)); 30 sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
31 return ret; 31 return ret;
32 } 32 }
33 33
@@ -37,7 +37,7 @@ static int handle_lost_service(sd_bus_message *msg,
37 using_standard_protocol(watcher) ? cmp_id : cmp_service, service); 37 using_standard_protocol(watcher) ? cmp_id : cmp_service, service);
38 if (idx != -1) { 38 if (idx != -1) {
39 char *id = watcher->items->items[idx]; 39 char *id = watcher->items->items[idx];
40 wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id); 40 sway_log(SWAY_DEBUG, "Unregistering Status Notifier Item '%s'", id);
41 list_del(watcher->items, idx); 41 list_del(watcher->items, idx);
42 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 42 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
43 "StatusNotifierItemUnregistered", "s", id); 43 "StatusNotifierItemUnregistered", "s", id);
@@ -46,7 +46,7 @@ static int handle_lost_service(sd_bus_message *msg,
46 46
47 idx = list_seq_find(watcher->hosts, cmp_id, service); 47 idx = list_seq_find(watcher->hosts, cmp_id, service);
48 if (idx != -1) { 48 if (idx != -1) {
49 wlr_log(WLR_DEBUG, "Unregistering Status Notifier Host '%s'", service); 49 sway_log(SWAY_DEBUG, "Unregistering Status Notifier Host '%s'", service);
50 free(watcher->hosts->items[idx]); 50 free(watcher->hosts->items[idx]);
51 list_del(watcher->hosts, idx); 51 list_del(watcher->hosts, idx);
52 } 52 }
@@ -59,7 +59,7 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
59 char *service_or_path, *id; 59 char *service_or_path, *id;
60 int ret = sd_bus_message_read(msg, "s", &service_or_path); 60 int ret = sd_bus_message_read(msg, "s", &service_or_path);
61 if (ret < 0) { 61 if (ret < 0) {
62 wlr_log(WLR_ERROR, "Failed to parse register SNI message: %s", strerror(-ret)); 62 sway_log(SWAY_ERROR, "Failed to parse register SNI message: %s", strerror(-ret));
63 return ret; 63 return ret;
64 } 64 }
65 65
@@ -81,12 +81,12 @@ static int register_sni(sd_bus_message *msg, void *data, sd_bus_error *error) {
81 } 81 }
82 82
83 if (list_seq_find(watcher->items, cmp_id, id) == -1) { 83 if (list_seq_find(watcher->items, cmp_id, id) == -1) {
84 wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id); 84 sway_log(SWAY_DEBUG, "Registering Status Notifier Item '%s'", id);
85 list_add(watcher->items, id); 85 list_add(watcher->items, id);
86 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 86 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
87 "StatusNotifierItemRegistered", "s", id); 87 "StatusNotifierItemRegistered", "s", id);
88 } else { 88 } else {
89 wlr_log(WLR_DEBUG, "Status Notifier Item '%s' already registered", id); 89 sway_log(SWAY_DEBUG, "Status Notifier Item '%s' already registered", id);
90 free(id); 90 free(id);
91 } 91 }
92 92
@@ -97,18 +97,18 @@ static int register_host(sd_bus_message *msg, void *data, sd_bus_error *error) {
97 char *service; 97 char *service;
98 int ret = sd_bus_message_read(msg, "s", &service); 98 int ret = sd_bus_message_read(msg, "s", &service);
99 if (ret < 0) { 99 if (ret < 0) {
100 wlr_log(WLR_ERROR, "Failed to parse register host message: %s", strerror(-ret)); 100 sway_log(SWAY_ERROR, "Failed to parse register host message: %s", strerror(-ret));
101 return ret; 101 return ret;
102 } 102 }
103 103
104 struct swaybar_watcher *watcher = data; 104 struct swaybar_watcher *watcher = data;
105 if (list_seq_find(watcher->hosts, cmp_id, service) == -1) { 105 if (list_seq_find(watcher->hosts, cmp_id, service) == -1) {
106 wlr_log(WLR_DEBUG, "Registering Status Notifier Host '%s'", service); 106 sway_log(SWAY_DEBUG, "Registering Status Notifier Host '%s'", service);
107 list_add(watcher->hosts, strdup(service)); 107 list_add(watcher->hosts, strdup(service));
108 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface, 108 sd_bus_emit_signal(watcher->bus, obj_path, watcher->interface,
109 "StatusNotifierHostRegistered", "s", service); 109 "StatusNotifierHostRegistered", "s", service);
110 } else { 110 } else {
111 wlr_log(WLR_DEBUG, "Status Notifier Host '%s' already registered", service); 111 sway_log(SWAY_DEBUG, "Status Notifier Host '%s' already registered", service);
112 } 112 }
113 113
114 return sd_bus_reply_method_return(msg, ""); 114 return sd_bus_reply_method_return(msg, "");
@@ -166,7 +166,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
166 int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path, 166 int ret = sd_bus_add_object_vtable(bus, &vtable_slot, obj_path,
167 watcher->interface, watcher_vtable, watcher); 167 watcher->interface, watcher_vtable, watcher);
168 if (ret < 0) { 168 if (ret < 0) {
169 wlr_log(WLR_ERROR, "Failed to add object vtable: %s", strerror(-ret)); 169 sway_log(SWAY_ERROR, "Failed to add object vtable: %s", strerror(-ret));
170 goto error; 170 goto error;
171 } 171 }
172 172
@@ -174,14 +174,14 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
174 "/org/freedesktop/DBus", "org.freedesktop.DBus", 174 "/org/freedesktop/DBus", "org.freedesktop.DBus",
175 "NameOwnerChanged", handle_lost_service, watcher); 175 "NameOwnerChanged", handle_lost_service, watcher);
176 if (ret < 0) { 176 if (ret < 0) {
177 wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s", 177 sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
178 strerror(-ret)); 178 strerror(-ret));
179 goto error; 179 goto error;
180 } 180 }
181 181
182 ret = sd_bus_request_name(bus, watcher->interface, 0); 182 ret = sd_bus_request_name(bus, watcher->interface, 0);
183 if (ret < 0) { 183 if (ret < 0) {
184 wlr_log(WLR_ERROR, "Failed to acquire service name: %s", strerror(-ret)); 184 sway_log(SWAY_ERROR, "Failed to acquire service name: %s", strerror(-ret));
185 goto error; 185 goto error;
186 } 186 }
187 187
@@ -192,7 +192,7 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
192 watcher->hosts = create_list(); 192 watcher->hosts = create_list();
193 watcher->items = create_list(); 193 watcher->items = create_list();
194 watcher->version = 0; 194 watcher->version = 0;
195 wlr_log(WLR_DEBUG, "Registered %s", watcher->interface); 195 sway_log(SWAY_DEBUG, "Registered %s", watcher->interface);
196 return watcher; 196 return watcher;
197error: 197error:
198 sd_bus_slot_unref(signal_slot); 198 sd_bus_slot_unref(signal_slot);