#1403: ensure align = left is the default and update documentation accordingly
Patch status: merged
Patch by Ingo Bürk
To apply this patch, use:
curl http://cr.i3wm.org/patch/683/raw.patch | git am
b/docs/i3bar-protocol
16 |
@@ -148,7 +148,7 @@ min_width:: |
17 |
when you want to set a sensible minimum width regardless of which font you |
18 |
are using, and at what particular size. |
19 |
align:: |
20 |
- Align text on the +center+ (default), +right+ or +left+ of the block, when |
21 |
+ Align text on the +center+, +right+ or +left+ (default) of the block, when |
22 |
the minimum width of the latter, specified by the +min_width+ key, is not |
23 |
reached. |
24 |
name and instance:: |
b/i3bar/include/common.h
29 |
@@ -27,6 +27,7 @@ struct rect_t { |
30 |
}; |
31 |
|
32 |
typedef enum { |
33 |
+ /* First value to make it the default. */ |
34 |
ALIGN_LEFT, |
35 |
ALIGN_CENTER, |
36 |
ALIGN_RIGHT |
b/i3bar/src/child.c
41 |
@@ -188,12 +188,12 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) { |
42 |
sasprintf(&(ctx->block.color), "%.*s", len, val); |
43 |
} |
44 |
if (strcasecmp(ctx->last_map_key, "align") == 0) { |
45 |
- if (len == strlen("left") && !strncmp((const char *)val, "left", strlen("left"))) { |
46 |
- ctx->block.align = ALIGN_LEFT; |
47 |
+ if (len == strlen("center") && !strncmp((const char *)val, "center", strlen("center"))) { |
48 |
+ ctx->block.align = ALIGN_CENTER; |
49 |
} else if (len == strlen("right") && !strncmp((const char *)val, "right", strlen("right"))) { |
50 |
ctx->block.align = ALIGN_RIGHT; |
51 |
} else { |
52 |
- ctx->block.align = ALIGN_CENTER; |
53 |
+ ctx->block.align = ALIGN_LEFT; |
54 |
} |
55 |
} else if (strcasecmp(ctx->last_map_key, "min_width") == 0) { |
56 |
i3String *text = i3string_from_utf8_with_length((const char *)val, len); |