add boolean to ignore space/display association temporarily

This commit is contained in:
Felix Kratz 2022-03-31 17:18:12 +02:00
parent bcb8b66442
commit fa7c8c9c4c
6 changed files with 13 additions and 2 deletions

View file

@ -174,6 +174,7 @@ A list of properties available to the *set* command is listed below (components
| `position` | `left`, `right`, `center` | | Position of the item in the bar |
| `associated_space` | `<positive_integer list>` | `0` | Spaces to show this item on |
| `associated_display` | `<positive_integer list>` | `0` | Displays to show this item on |
| `ignore_association` | `<boolean>` | `off` | Ignores all space / display associations while on (Only on HEAD) |
| `y_offset` | `<integer>` | `0` | Vertical offset applied to the `text` |
| `width` | `<positive_integer>` or `dynamic` | `dynamic` | Makes the *item* use a fixed *width* given in points |
| `align` | `center`, `left`, `right` | `left` | Aligns the `item` content in its container when it has a fixed `width` larger than the content width |

View file

@ -11,10 +11,12 @@ void bar_draw_graph(struct bar* bar, struct bar_item* bar_item, uint32_t x, bool
bool bar_draws_item(struct bar* bar, struct bar_item* bar_item) {
if (!bar_item->drawing || !bar->shown) return false;
if (bar_item->associated_display > 0
&& !(bar_item->associated_display & (1 << bar->adid)))
&& (!(bar_item->associated_display & (1 << bar->adid)))
&& !bar_item->ignore_association)
return false;
if (bar_item->associated_space > 0
&& !(bar_item->associated_space & (1 << bar->sid))
&& (!(bar_item->associated_space & (1 << bar->sid))
&& !bar_item->ignore_association)
&& (bar_item->type != BAR_COMPONENT_SPACE) )
return false;
if (bar_item->position == POSITION_POPUP)

View file

@ -79,6 +79,7 @@ void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) {
bar_item->updates_only_when_shown = false;
bar_item->selected = false;
bar_item->mouse_over = false;
bar_item->ignore_association = false;
bar_item->counter = 0;
bar_item->type = BAR_ITEM;
bar_item->update_frequency = 0;

View file

@ -21,6 +21,7 @@ struct bar_item {
bool lazy;
bool selected;
bool mouse_over;
bool ignore_association;
// Drawing Modifiers
bool drawing;

View file

@ -1,4 +1,5 @@
#include "message.h"
#include "misc/defines.h"
extern struct event_loop g_event_loop;
extern struct bar_manager g_bar_manager;
@ -307,6 +308,10 @@ static void message_parse_set_message_for_bar_item(FILE* rsp, struct bar_item* b
printf("cache_scripts property is deprecated.\n");
} else if (token_equals(property, PROPERTY_LAZY)) {
bar_item->lazy = evaluate_boolean_state(get_token(&message), bar_item->lazy);
} else if (token_equals(property, PROPERTY_IGNORE_ASSOCIATION)) {
bar_item->ignore_association = evaluate_boolean_state(get_token(&message),
bar_item->ignore_association);
needs_update = true;
} else if (token_equals(property, COMMAND_DEFAULT_RESET)) {
bar_item_init(&g_bar_manager.default_item, NULL);
} else {

View file

@ -68,6 +68,7 @@
#define PROPERTY_LABEL "label"
#define PROPERTY_CACHE_SCRIPTS "cache_scripts"
#define PROPERTY_LAZY "lazy"
#define PROPERTY_IGNORE_ASSOCIATION "ignore_association"
#define DOMAIN_BAR "--bar"
#define PROPERTY_POSITION "position"