diff options
Diffstat (limited to 'swaybar/i3bar.c')
-rw-r--r-- | swaybar/i3bar.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 325aa61a..1d754808 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c | |||
@@ -6,7 +6,9 @@ | |||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <wlr/util/log.h> | 8 | #include <wlr/util/log.h> |
9 | #include "swaybar/bar.h" | ||
9 | #include "swaybar/config.h" | 10 | #include "swaybar/config.h" |
11 | #include "swaybar/i3bar.h" | ||
10 | #include "swaybar/status_line.h" | 12 | #include "swaybar/status_line.h" |
11 | 13 | ||
12 | void i3bar_block_unref(struct i3bar_block *block) { | 14 | void i3bar_block_unref(struct i3bar_block *block) { |
@@ -258,7 +260,7 @@ bool i3bar_handle_readable(struct status_line *status) { | |||
258 | 260 | ||
259 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | 261 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, |
260 | struct i3bar_block *block, int x, int y, enum x11_button button) { | 262 | struct i3bar_block *block, int x, int y, enum x11_button button) { |
261 | wlr_log(WLR_DEBUG, "block %s clicked", block->name ? block->name : "(nil)"); | 263 | wlr_log(WLR_DEBUG, "block %s clicked", block->name); |
262 | if (!block->name || !status->click_events) { | 264 | if (!block->name || !status->click_events) { |
263 | return HOTSPOT_PROCESS; | 265 | return HOTSPOT_PROCESS; |
264 | } | 266 | } |
@@ -274,10 +276,11 @@ enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | |||
274 | json_object_object_add(event_json, "button", json_object_new_int(button)); | 276 | json_object_object_add(event_json, "button", json_object_new_int(button)); |
275 | json_object_object_add(event_json, "x", json_object_new_int(x)); | 277 | json_object_object_add(event_json, "x", json_object_new_int(x)); |
276 | json_object_object_add(event_json, "y", json_object_new_int(y)); | 278 | json_object_object_add(event_json, "y", json_object_new_int(y)); |
277 | if (dprintf(status->write_fd, "%s,\n", | 279 | if (dprintf(status->write_fd, "%s%s\n", status->clicked ? "," : "", |
278 | json_object_to_json_string(event_json)) < 0) { | 280 | json_object_to_json_string(event_json)) < 0) { |
279 | status_error(status, "[failed to write click event]"); | 281 | status_error(status, "[failed to write click event]"); |
280 | } | 282 | } |
283 | status->clicked = true; | ||
281 | json_object_put(event_json); | 284 | json_object_put(event_json); |
282 | return HOTSPOT_IGNORE; | 285 | return HOTSPOT_IGNORE; |
283 | } | 286 | } |