mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-09-21 14:31:56 +00:00
only refresh bar for items that are actually shown
This commit is contained in:
parent
1eefbe821d
commit
58683ba4c2
4 changed files with 6 additions and 1 deletions
|
@ -211,6 +211,7 @@ void bar_refresh(struct bar *bar)
|
|||
|
||||
for (int i = 0; i < g_bar_manager.bar_item_count; i++) {
|
||||
struct bar_item* bar_item = g_bar_manager.bar_items[i];
|
||||
bar_item->is_shown = false;
|
||||
|
||||
if(bar_item->associated_display > 0 && !(bar_item->associated_display & (1 << did))) continue;
|
||||
if((strcmp(bar_item->identifier, BAR_COMPONENT_SPACE) != 0) && bar_item->associated_space > 0 && !(bar_item->associated_space & (1 << sid))) continue;
|
||||
|
@ -257,6 +258,7 @@ void bar_refresh(struct bar *bar)
|
|||
bar_draw_line(bar, *label, label_position.x, label_position.y);
|
||||
bar_item->label_line.bounds.origin = label_position;
|
||||
bar_item->icon_line.bounds.origin = icon_position;
|
||||
bar_item->is_shown = true;
|
||||
bar_item_set_bounding_rect_for_space(bar_item, sid, bar->origin);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ struct bar_item* bar_item_create() {
|
|||
}
|
||||
|
||||
void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) {
|
||||
bar_item->is_shown = false;
|
||||
bar_item->nospace = false;
|
||||
bar_item->counter = 0;
|
||||
bar_item->name = "";
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define UPDATE_TITLE_CHANGE 1 << 5
|
||||
|
||||
struct bar_item {
|
||||
bool is_shown;
|
||||
bool nospace;
|
||||
int counter;
|
||||
char type;
|
||||
|
|
|
@ -352,6 +352,7 @@ static void handle_domain_set(FILE* rsp, struct token domain, char* message) {
|
|||
bar_item->cache_scripts = token_equals(value, ARGUMENT_COMMON_VAL_ON) ? true : false;
|
||||
}
|
||||
|
||||
if (bar_item->is_shown)
|
||||
bar_manager_refresh(&g_bar_manager);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue