diff options
| -rwxr-xr-x | examplebar.sh | 3 | ||||
| -rw-r--r-- | src/tsar.c | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/examplebar.sh b/examplebar.sh index 4a30fcd..4f32786 100755 --- a/examplebar.sh +++ b/examplebar.sh @@ -1,7 +1,8 @@ #! /bin/sh # Put any monospace font here -./tsarc config font "Liberation Mono:style=Regular" +./tsarc config font "Liberation Mono:style=Regular:size=9" +./tsarc config height 16 ./tsarc create test_comp ./tsarc set test_comp -text "Testing spaces" @@ -97,6 +97,9 @@ void init_x(void) { gc = XCreateGC(display, win, 0, NULL); XSetForeground(display, gc, 0xFFFFFF); + for (int i = 0; i < 32; i++) { + XLowerWindow(display, win); + } XFlush(display); } @@ -128,10 +131,11 @@ void draw_comp_set(float pos_ratio, comp_t **set, int size) { } int x = (bar_width - width) * pos_ratio; + int y = (bar_height - font->height) / 2; for (int i = 0; i < size; i++) { comp_t *comp = set[i]; - draw_text(comp->data, x, 0); + draw_text(comp->data, x, y); x += font->max_advance_width * strlen(comp->data); } } @@ -148,12 +152,6 @@ int main(void) { XClearWindow(display, win); XResizeWindow(display, win, bar_width, bar_height); - int x = 0; - for (int i = 0; i < left_size; i++) { - comp_t* comp = comps_left[i]; - draw_text(comp->data, x, 0); - x += font->max_advance_width * strlen(comp->data); - } draw_comp_set(0, comps_left, left_size); draw_comp_set(0.5, comps_center, center_size); draw_comp_set(1, comps_right, right_size); |
