diff options
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 65d2a493..60687bc5 100644 --- a/swaybar/main.c +++ b/swaybar/main.c | |||
@@ -51,6 +51,7 @@ FILE *command; | |||
51 | char *line, *output, *status_command; | 51 | char *line, *output, *status_command; |
52 | struct registry *registry; | 52 | struct registry *registry; |
53 | struct window *window; | 53 | struct window *window; |
54 | bool dirty = true; | ||
54 | 55 | ||
55 | struct colors colors = { | 56 | struct colors colors = { |
56 | .background = 0x000000FF, | 57 | .background = 0x000000FF, |
@@ -278,6 +279,7 @@ void update() { | |||
278 | if (line[l] == '\n') { | 279 | if (line[l] == '\n') { |
279 | line[l] = '\0'; | 280 | line[l] = '\0'; |
280 | } | 281 | } |
282 | dirty = true; | ||
281 | } | 283 | } |
282 | } | 284 | } |
283 | if (ioctl(socketfd, FIONREAD, &pending) != -1 && pending > 0) { | 285 | if (ioctl(socketfd, FIONREAD, &pending) != -1 && pending > 0) { |
@@ -285,6 +287,7 @@ void update() { | |||
285 | char *buf = ipc_recv_response(socketfd, &len); | 287 | char *buf = ipc_recv_response(socketfd, &len); |
286 | free(buf); | 288 | free(buf); |
287 | ipc_update_workspaces(); | 289 | ipc_update_workspaces(); |
290 | dirty = true; | ||
288 | } | 291 | } |
289 | } | 292 | } |
290 | 293 | ||
@@ -425,8 +428,8 @@ int main(int argc, char **argv) { | |||
425 | window->height = height + MARGIN * 2; | 428 | window->height = height + MARGIN * 2; |
426 | 429 | ||
427 | do { | 430 | do { |
428 | if (window_prerender(window) && window->cairo) { | 431 | update(); |
429 | update(); | 432 | if (dirty && window_prerender(window) && window->cairo) { |
430 | render(); | 433 | render(); |
431 | window_render(window); | 434 | window_render(window); |
432 | } | 435 | } |