summaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/i3bar.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c
index 78cb5bd4..88404703 100644
--- a/swaybar/i3bar.c
+++ b/swaybar/i3bar.c
@@ -176,6 +176,21 @@ bool i3bar_handle_readable(struct status_line *status) {
176 json_object_put(test_object); 176 json_object_put(test_object);
177 } 177 }
178 178
179 // in order to print the json for debugging purposes
180 // the last character is temporarily replaced with a null character
181 // (the last character is used in case the buffer is full)
182 char *last_char_pos =
183 &status->buffer[buffer_pos + status->tokener->char_offset - 1];
184 char last_char = *last_char_pos;
185 while (isspace(last_char)) {
186 last_char = *--last_char_pos;
187 }
188 *last_char_pos = '\0';
189 size_t offset = strspn(&status->buffer[buffer_pos], " \f\n\r\t\v");
190 wlr_log(WLR_DEBUG, "Received i3bar json: '%s%c'",
191 &status->buffer[buffer_pos + offset], last_char);
192 *last_char_pos = last_char;
193
179 buffer_pos += status->tokener->char_offset; 194 buffer_pos += status->tokener->char_offset;
180 status->expecting_comma = true; 195 status->expecting_comma = true;
181 196
@@ -221,6 +236,7 @@ bool i3bar_handle_readable(struct status_line *status) {
221 } 236 }
222 237
223 if (last_object) { 238 if (last_object) {
239 wlr_log(WLR_DEBUG, "Rendering last received json");
224 i3bar_parse_json(status, last_object); 240 i3bar_parse_json(status, last_object);
225 json_object_put(last_object); 241 json_object_put(last_object);
226 return true; 242 return true;