mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 20:03:10 +00:00
allow hiding items
This commit is contained in:
parent
3862b91271
commit
d3a2194f67
5 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
struct bar_item {
|
||||
bool enabled;
|
||||
bool hidden;
|
||||
bool is_shown;
|
||||
bool nospace;
|
||||
int counter;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue