diff --git a/src/bar.c b/src/bar.c index 84750b4..5737bc2 100644 --- a/src/bar.c +++ b/src/bar.c @@ -175,7 +175,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]; - if (!bar_item->enabled) continue; + if (!bar_item->enabled || bar_item->hidden) continue; bar_item->is_shown = false; if(bar_item->associated_display > 0 && !(bar_item->associated_display & (1 << did))) continue; diff --git a/src/bar_item.c b/src/bar_item.c index 337ee2a..832c90c 100644 --- a/src/bar_item.c +++ b/src/bar_item.c @@ -8,6 +8,7 @@ struct bar_item* bar_item_create() { void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) { bar_item->enabled = true; + bar_item->hidden = false; bar_item->is_shown = false; bar_item->nospace = false; bar_item->counter = 0; diff --git a/src/bar_item.h b/src/bar_item.h index 0d233a0..f3507de 100644 --- a/src/bar_item.h +++ b/src/bar_item.h @@ -12,6 +12,7 @@ struct bar_item { bool enabled; + bool hidden; bool is_shown; bool nospace; int counter; diff --git a/src/bar_manager.c b/src/bar_manager.c index 4ad6183..cdb5880 100644 --- a/src/bar_manager.c +++ b/src/bar_manager.c @@ -152,7 +152,7 @@ void bar_manager_check_bar_items_for_update_pattern(struct bar_manager* bar_mana struct bar_item* bar_manager_get_item_by_point(struct bar_manager* bar_manager, CGPoint point, uint32_t sid) { for (int i = 0; i < bar_manager->bar_item_count; i++) { struct bar_item* bar_item = bar_manager->bar_items[i]; - if (!bar_item->enabled || bar_item->num_rects < sid || bar_item->bounding_rects[sid - 1] == NULL) continue; + if (!bar_item->enabled || bar_item->hidden || bar_item->num_rects < sid || bar_item->bounding_rects[sid - 1] == NULL) continue; if (cgrect_contains_point(bar_item->bounding_rects[sid - 1], &point)) { return bar_item; } diff --git a/src/message.c b/src/message.c index 83e2b96..8af76e4 100644 --- a/src/message.c +++ b/src/message.c @@ -29,6 +29,7 @@ extern bool g_verbose; #define DOMAIN_SET "set" #define COMMAND_SET_ENABLED "enabled" +#define COMMAND_SET_HIDDEN "hidden" #define COMMAND_SET_POSITION "position" #define COMMAND_SET_ASSOCIATED_DISPLAY "associated_display" #define COMMAND_SET_ASSOCIATED_SPACE "associated_space" @@ -367,9 +368,13 @@ static void handle_domain_set(FILE* rsp, struct token domain, char* message) { } else if (token_equals(property, COMMAND_SET_ENABLED)) { struct token value = get_token(&message); bar_item->enabled = token_equals(value, ARGUMENT_COMMON_VAL_ON) ? true : false; + } else if (token_equals(property, COMMAND_SET_HIDDEN)) { + struct token value = get_token(&message); + bar_item->hidden = token_equals(value, ARGUMENT_COMMON_VAL_ON) ? true : false; } + if (bar_item->is_shown) bar_manager_refresh(&g_bar_manager); }