i3 - improved tiling WM


i3-nagbar: Set button inner-width to the width of the label

Patch status: needinfo

Patch by Tony Crisci

Long description:

Use predict_text_width to find the width of the label and then account
for right padding when calculating the width of the button.

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

b/i3-nagbar/main.c

15
@@ -230,8 +230,7 @@ static int handle_expose(xcb_connection_t *conn, xcb_expose_event_t *event) {
16
     /* render custom buttons */
17
     line_width = 1;
18
     for (int c = 0; c < buttoncnt; c++) {
19
-        /* TODO: make w = text extents of the label */
20
-        w = 100;
21
+        w = predict_text_width(buttons[c].label) + 12;
22
         y -= 30;
23
         xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ color_button_background });
24
         close = (xcb_rectangle_t){ y - w - (2 * line_width), 2, w + (2 * line_width), rect.height - 6 };