diff options
author | 2016-04-24 17:58:53 -0400 | |
---|---|---|
committer | 2016-04-24 17:58:53 -0400 | |
commit | 7efa9ab34ae1dabcc7c87d22bfba0b1312c8c662 (patch) | |
tree | 2364d4662a641f368d83494aa03b6b0879e97ca8 /swaybar | |
parent | Merge pull request #598 from Hummer12007/pango_fix (diff) | |
parent | Renamed pango_markup config options (diff) | |
download | sway-7efa9ab34ae1dabcc7c87d22bfba0b1312c8c662.tar.gz sway-7efa9ab34ae1dabcc7c87d22bfba0b1312c8c662.tar.zst sway-7efa9ab34ae1dabcc7c87d22bfba0b1312c8c662.zip |
Merge pull request #601 from Hummer12007/pango_markup_config
Pango markup config
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/config.c | 1 | ||||
-rw-r--r-- | swaybar/ipc.c | 6 | ||||
-rw-r--r-- | swaybar/render.c | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/swaybar/config.c b/swaybar/config.c index 6b9ff86b..7bd22c91 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -46,6 +46,7 @@ char *parse_font(const char *font) { | |||
46 | struct config *init_config() { | 46 | struct config *init_config() { |
47 | struct config *config = calloc(1, sizeof(struct config)); | 47 | struct config *config = calloc(1, sizeof(struct config)); |
48 | config->status_command = NULL; | 48 | config->status_command = NULL; |
49 | config->pango_markup = true; | ||
49 | config->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; | 50 | config->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; |
50 | config->font = strdup("monospace 10"); | 51 | config->font = strdup("monospace 10"); |
51 | config->mode = NULL; | 52 | config->mode = NULL; |
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 312c79b9..dacee4c2 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -12,6 +12,7 @@ static void ipc_parse_config(struct config *config, const char *payload) { | |||
12 | json_object *tray_output, *mode, *hidden_bar, *position, *status_command; | 12 | json_object *tray_output, *mode, *hidden_bar, *position, *status_command; |
13 | json_object *font, *bar_height, *workspace_buttons, *strip_workspace_numbers; | 13 | json_object *font, *bar_height, *workspace_buttons, *strip_workspace_numbers; |
14 | json_object *binding_mode_indicator, *verbose, *colors, *sep_symbol, *outputs; | 14 | json_object *binding_mode_indicator, *verbose, *colors, *sep_symbol, *outputs; |
15 | json_object *markup; | ||
15 | json_object_object_get_ex(bar_config, "tray_output", &tray_output); | 16 | json_object_object_get_ex(bar_config, "tray_output", &tray_output); |
16 | json_object_object_get_ex(bar_config, "mode", &mode); | 17 | json_object_object_get_ex(bar_config, "mode", &mode); |
17 | json_object_object_get_ex(bar_config, "hidden_bar", &hidden_bar); | 18 | json_object_object_get_ex(bar_config, "hidden_bar", &hidden_bar); |
@@ -26,6 +27,7 @@ static void ipc_parse_config(struct config *config, const char *payload) { | |||
26 | json_object_object_get_ex(bar_config, "separator_symbol", &sep_symbol); | 27 | json_object_object_get_ex(bar_config, "separator_symbol", &sep_symbol); |
27 | json_object_object_get_ex(bar_config, "colors", &colors); | 28 | json_object_object_get_ex(bar_config, "colors", &colors); |
28 | json_object_object_get_ex(bar_config, "outputs", &outputs); | 29 | json_object_object_get_ex(bar_config, "outputs", &outputs); |
30 | json_object_object_get_ex(bar_config, "pango_markup", &markup); | ||
29 | 31 | ||
30 | if (status_command) { | 32 | if (status_command) { |
31 | free(config->status_command); | 33 | free(config->status_command); |
@@ -62,6 +64,10 @@ static void ipc_parse_config(struct config *config, const char *payload) { | |||
62 | config->height = json_object_get_int(bar_height); | 64 | config->height = json_object_get_int(bar_height); |
63 | } | 65 | } |
64 | 66 | ||
67 | if (markup) { | ||
68 | config->pango_markup = json_object_get_boolean(markup); | ||
69 | } | ||
70 | |||
65 | // free previous outputs list | 71 | // free previous outputs list |
66 | int i; | 72 | int i; |
67 | for (i = 0; i < config->outputs->length; ++i) { | 73 | for (i = 0; i < config->outputs->length; ++i) { |
diff --git a/swaybar/render.c b/swaybar/render.c index 5901b557..273bd4f0 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -278,9 +278,9 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
278 | int width, height; | 278 | int width, height; |
279 | 279 | ||
280 | if (line->protocol == TEXT) { | 280 | if (line->protocol == TEXT) { |
281 | get_text_size(window->cairo, window->font, &width, &height, true, "%s", line->text_line); | 281 | get_text_size(window->cairo, window->font, &width, &height, config->pango_markup, "%s", line->text_line); |
282 | cairo_move_to(cairo, window->width - margin - width, margin); | 282 | cairo_move_to(cairo, window->width - margin - width, margin); |
283 | pango_printf(window->cairo, window->font, true, "%s", line->text_line); | 283 | pango_printf(window->cairo, window->font, config->pango_markup, "%s", line->text_line); |
284 | } else if (line->protocol == I3BAR && line->block_line) { | 284 | } else if (line->protocol == I3BAR && line->block_line) { |
285 | double pos = window->width - 0.5; | 285 | double pos = window->width - 0.5; |
286 | bool edge = true; | 286 | bool edge = true; |