-
-
Save pauldub/a7ca642420fcf1a00c390d997765f01a to your computer and use it in GitHub Desktop.
Patch to make powerline separators span the full height in the i3bar - Very hacky, use at own risk! - Designed for use with greshake/i3status-rust - Only tested on 1080p wo/ scaling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libi3/font.c b/libi3/font.c | |
index 9433467c..3659f4da 100644 | |
--- a/libi3/font.c | |
+++ b/libi3/font.c | |
@@ -87,10 +87,12 @@ static bool load_pango_font(i3Font *font, const char *desc) { | |
static void draw_text_pango(const char *text, size_t text_len, | |
xcb_drawable_t drawable, xcb_visualtype_t *visual, int x, int y, | |
int max_width, bool pango_markup) { | |
+ bool separator = (text[0] == ""[0]) || (text[0] == "🭅"[0]); | |
/* Create the Pango layout */ | |
/* root_visual_type is cached in load_pango_font */ | |
- cairo_surface_t *surface = cairo_xcb_surface_create(conn, drawable, | |
- visual, x + max_width, y + savedFont->height); | |
+ cairo_surface_t *surface = cairo_xcb_surface_create(conn, drawable, visual, | |
+ x + max_width + (separator ? 5 : 0), | |
+ y + savedFont->height + (separator ? 2 : 0)); | |
cairo_t *cr = cairo_create(surface); | |
PangoLayout *layout = create_layout_with_dpi(cr); | |
gint height; | |
@@ -98,7 +100,7 @@ static void draw_text_pango(const char *text, size_t text_len, | |
pango_layout_set_font_description(layout, savedFont->specific.pango_desc); | |
pango_layout_set_width(layout, max_width * PANGO_SCALE); | |
pango_layout_set_wrap(layout, PANGO_WRAP_CHAR); | |
- pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); | |
+ pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); | |
if (pango_markup) | |
pango_layout_set_markup(layout, text, text_len); | |
@@ -111,8 +113,8 @@ static void draw_text_pango(const char *text, size_t text_len, | |
pango_cairo_update_layout(cr, layout); | |
pango_layout_get_pixel_size(layout, NULL, &height); | |
/* Center the piece of text vertically. */ | |
- int yoffset = (height - savedFont->height) / 2; | |
- cairo_move_to(cr, x, y - yoffset); | |
+ int yoffset = /*(height < savedFont->height ? 0.5 : 1)*/ 0.5 * (height - savedFont->height); | |
+ cairo_move_to(cr, x - (separator ? 3 : 0), y - yoffset); | |
pango_cairo_show_layout(cr, layout); | |
/* Free resources */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment