]> git.sur5r.net Git - i3/i3/commitdiff
Don't display empty strings from i3status in i3bar
authorMarcel Hellwig <keks@cookiesoft.de>
Sun, 8 Jul 2012 19:31:34 +0000 (21:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 11 Jul 2012 17:06:02 +0000 (19:06 +0200)
i3bar/src/xcb.c

index 0091507b42489101891f3b8083e71a6b1fd16456..289d7d9ed96a5e759bafe8784c24edc7c14df154 100644 (file)
@@ -117,6 +117,9 @@ void refresh_statusline() {
     /* Convert all blocks from UTF-8 to UCS-2 and predict the text width (in
      * pixels). */
     TAILQ_FOREACH(block, &statusline_head, blocks) {
+        if (strlen(block->full_text) == 0)
+            continue;
+
         block->ucs2_full_text = (xcb_char2b_t*)convert_utf8_to_ucs2(block->full_text, &(block->glyph_count_full_text));
         block->width = predict_text_width((char*)block->ucs2_full_text, block->glyph_count_full_text, true);
         /* If this is not the last block, add some pixels for a separator. */
@@ -138,6 +141,9 @@ void refresh_statusline() {
     /* Draw the text of each block. */
     uint32_t x = 0;
     TAILQ_FOREACH(block, &statusline_head, blocks) {
+        if (strlen(block->full_text) == 0)
+            continue;
+
         uint32_t colorpixel = (block->color ? get_colorpixel(block->color) : colors.bar_fg);
         set_font_colors(statusline_ctx, colorpixel, colors.bar_bg);
         draw_text((char*)block->ucs2_full_text, block->glyph_count_full_text,