i3 - improved tiling WM


Allow min_width of a block in i3bar to be a string

Patch status: superseded

Patch by AndrĂ¡s Mohari

Long description:

With this change, min_width can either be an integer (as usual), or a
string. In the latter case, the width of the text given by min_width
determines the minimum width of the block. This way one does not have to
figure out a minimum width by trial and error, only to do it again every
time the font is changed.

To apply this patch, use:
curl http://cr.i3wm.org/patch/57/raw.patch | git am

b/i3bar/src/child.c

18
@@ -140,6 +140,10 @@ static int stdin_string(void *context, const unsigned char *val, unsigned int le
19
         } else {
20
             ctx->block.align = ALIGN_CENTER;
21
         }
22
+    } else if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
23
+        i3String *text = i3string_from_utf8_with_length((const char *)val, len);
24
+        ctx->block.min_width = (uint32_t)predict_text_width(text);
25
+        i3string_free(text);
26
     }
27
     return 1;
28
 }