setting the associated_display manually overrides the new logic

This commit is contained in:
Felix Kratz 2022-06-27 19:30:44 +02:00
parent f1f8d367f6
commit d4befc2d52
4 changed files with 12 additions and 7 deletions

View file

@ -81,6 +81,7 @@ void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) {
bar_item->selected = false;
bar_item->mouse_over = false;
bar_item->ignore_association = false;
bar_item->overrides_association = false;
bar_item->counter = 0;
bar_item->type = BAR_ITEM;
bar_item->update_frequency = 0;
@ -134,6 +135,7 @@ void bar_item_append_associated_display(struct bar_item* bar_item, uint32_t bit)
if (bar_item->associated_display & bit) return;
bar_item->associated_display |= bit;
if (bar_item->type == BAR_COMPONENT_SPACE) {
bar_item->overrides_association = true;
bar_item->associated_display = bit;
char did_str[32];
sprintf(did_str, "%u", get_set_bit_position(bit));

View file

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

View file

@ -379,13 +379,14 @@ void bar_manager_update_space_components(struct bar_manager* bar_manager, bool f
struct bar_item* bar_item = bar_manager->bar_items[i];
if (bar_item->type != BAR_COMPONENT_SPACE) continue;
uint32_t space = get_set_bit_position(bar_item->associated_space);
uint32_t space_did = display_id_for_space(space);
if (space_did)
bar_item->associated_display = 1 << (display_arrangement(space_did));
else
bar_item->associated_display = 1 << 31;
if (!bar_item->overrides_association) {
uint32_t space = get_set_bit_position(bar_item->associated_space);
uint32_t space_did = display_id_for_space(space);
if (space_did)
bar_item->associated_display = 1 << (display_arrangement(space_did));
else
bar_item->associated_display = 1 << 31;
}
for (int j = 0; j < bar_manager->bar_count; j++) {
struct bar* bar = bar_manager->bars[j];
uint32_t did = bar->adid;

View file

@ -442,6 +442,7 @@ out:
static inline uint32_t display_id_for_space(uint32_t sid) {
uint64_t dsid = dsid_from_sid(sid);
if (!dsid) return 0;
CFStringRef uuid_string = SLSCopyManagedDisplayForSpace(g_connection, dsid);
if (!uuid_string) return 0;