From 1e1bf3dd787b081ac8e22c274aede78366e867d4 Mon Sep 17 00:00:00 2001 From: FelixKratz Date: Tue, 10 Aug 2021 12:08:11 +0200 Subject: [PATCH] fixed a layout bug --- plugins/clock.sh | 2 +- src/bar.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/clock.sh b/plugins/clock.sh index f20eceb..e73a548 100644 --- a/plugins/clock.sh +++ b/plugins/clock.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -spacebar -m set clock label $(date '+%d/%m %H:%M') +spacebar -m set clock label "$(date '+%d/%m %H:%M')" diff --git a/src/bar.c b/src/bar.c index cf262f0..4f6d6f8 100644 --- a/src/bar.c +++ b/src/bar.c @@ -179,7 +179,7 @@ int bar_get_center_length(struct bar_manager* bar_manager) { int total_length = 0; for (int i = 0; i < bar_manager->bar_item_count; i++) { struct bar_item* bar_item = bar_manager->bar_items[i]; - if (bar_item->position == 'c') { + if (bar_item->position == BAR_POSITION_CENTER) { total_length += bar_item->label_line.bounds.size.width + bar_item->icon_line.bounds.size.width + bar_item->icon_spacing_right + bar_item->label_spacing_left; if (i > 0) { total_length += bar_manager->bar_items[i-1]->label_spacing_right + bar_item->icon_spacing_left; @@ -218,7 +218,7 @@ void bar_refresh(struct bar *bar) if (bar_item->position == BAR_POSITION_LEFT) { icon_position.x = bar_left_final_item_x + bar_item->icon_spacing_left; - label_position.x = icon_position.x + label->bounds.size.width + bar_item->icon_spacing_right + bar_item->label_spacing_left; + label_position.x = icon_position.x + icon->bounds.size.width + bar_item->icon_spacing_right + bar_item->label_spacing_left; bar_left_final_item_x = label_position.x + label->bounds.size.width + bar_item->label_spacing_right; } @@ -230,7 +230,7 @@ void bar_refresh(struct bar *bar) if (bar_item->position == BAR_POSITION_CENTER) { icon_position.x = bar_center_first_item_x + bar_item->icon_spacing_left; - label_position.x = icon_position.x + label->bounds.size.width + bar_item->icon_spacing_right + bar_item->label_spacing_left; + label_position.x = icon_position.x + icon->bounds.size.width + bar_item->icon_spacing_right + bar_item->label_spacing_left; bar_center_first_item_x = label_position.x + label->bounds.size.width + bar_item->label_spacing_right; }