aboutsummaryrefslogtreecommitdiff
path: root/swaybar
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-04-17 11:35:22 -0400
committerDrew DeVault <sir@cmpwn.com>2016-04-17 11:36:03 -0400
commit84fae94ab9ca7fd148c786d224c49205a212882e (patch)
treed3d3e8a16f96e400ee07cc44e2f9110195bea02a /swaybar
parent083316c5cec77a20d29857b2c2743cbc6ded827b (diff)
Flesh out pango markup implementation
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/render.c13
-rw-r--r--swaybar/status_line.c7
2 files changed, 13 insertions, 7 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index fff47ab0..3eb824fe 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -136,7 +136,7 @@ static void render_block(struct window *window, struct config *config, struct st
cairo_move_to(window->cairo, offset, margin);
cairo_set_source_u32(window->cairo, block->color);
- pango_printf(window->cairo, window->font, "%s", block->full_text);
+ pango_printf(window->cairo, window->font, block->markup, "%s", block->full_text);
pos += width;
@@ -159,7 +159,7 @@ static void render_block(struct window *window, struct config *config, struct st
if (config->sep_symbol) {
offset = pos + (block->separator_block_width - sep_width) / 2;
cairo_move_to(window->cairo, offset, margin);
- pango_printf(window->cairo, window->font, "%s", config->sep_symbol);
+ pango_printf(window->cairo, window->font, false, "%s", config->sep_symbol);
} else {
cairo_set_line_width(window->cairo, 1);
cairo_move_to(window->cairo, pos + block->separator_block_width/2,
@@ -228,7 +228,7 @@ static void render_workspace_button(struct window *window, struct config *config
// text
cairo_set_source_u32(window->cairo, box_colors.text);
cairo_move_to(window->cairo, (int)*x + ws_horizontal_padding, margin);
- pango_printf(window->cairo, window->font, "%s", name);
+ pango_printf(window->cairo, window->font, false, "%s", name);
*x += width + ws_horizontal_padding * 2 + ws_spacing;
@@ -254,7 +254,7 @@ static void render_binding_mode_indicator(struct window *window, struct config *
// text
cairo_set_source_u32(window->cairo, config->colors.binding_mode.text);
cairo_move_to(window->cairo, (int)pos + ws_horizontal_padding, margin);
- pango_printf(window->cairo, window->font, "%s", config->mode);
+ pango_printf(window->cairo, window->font, false, "%s", config->mode);
}
void render(struct output *output, struct config *config, struct status_line *line) {
@@ -280,7 +280,7 @@ void render(struct output *output, struct config *config, struct status_line *li
if (line->protocol == TEXT) {
get_text_size(window->cairo, window->font, &width, &height, "%s", line->text_line);
cairo_move_to(cairo, window->width - margin - width, margin);
- pango_printf(window->cairo, window->font, "%s", line->text_line);
+ pango_printf(window->cairo, window->font, true, "%s", line->text_line);
} else if (line->protocol == I3BAR && line->block_line) {
double pos = window->width - 0.5;
bool edge = true;
@@ -312,7 +312,8 @@ void render(struct output *output, struct config *config, struct status_line *li
void set_window_height(struct window *window, int height) {
int text_width, text_height;
- get_text_size(window->cairo, window->font, &text_width, &text_height, "Test string for measuring purposes");
+ get_text_size(window->cairo, window->font, &text_width, &text_height, false,
+ "Test string for measuring purposes");
if (height > 0) {
margin = (height - text_height) / 2;
ws_vertical_padding = margin - 1.5;
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index ba6de6a1..63db702f 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -71,7 +71,7 @@ static void parse_json(struct bar *bar, const char *text) {
json_object *full_text, *short_text, *color, *min_width, *align, *urgent;
json_object *name, *instance, *separator, *separator_block_width;
json_object *background, *border, *border_top, *border_bottom;
- json_object *border_left, *border_right;
+ json_object *border_left, *border_right, *markup;
json_object *json = json_object_array_get_idx(results, i);
if (!json) {
@@ -86,6 +86,7 @@ static void parse_json(struct bar *bar, const char *text) {
json_object_object_get_ex(json, "urgent", &urgent);
json_object_object_get_ex(json, "name", &name);
json_object_object_get_ex(json, "instance", &instance);
+ json_object_object_get_ex(json, "markup", &markup);
json_object_object_get_ex(json, "separator", &separator);
json_object_object_get_ex(json, "separator_block_width", &separator_block_width);
json_object_object_get_ex(json, "background", &background);
@@ -139,6 +140,10 @@ static void parse_json(struct bar *bar, const char *text) {
new->instance = strdup(json_object_get_string(instance));
}
+ if (markup) {
+ new->markup = json_object_get_boolean(markup);
+ }
+
if (separator) {
new->separator = json_object_get_int(separator);
} else {