Only send modifier event once for active modifiers

This makes sure that a modifier event is only sent for active bar
modifiers, and that it is only sent once for each of those modifiers.

An active bar modifier is a modifier defined for a bar with `mode hide`
and `hidden_state hide`.
This commit is contained in:
Mikkel Oscar Lyderik 2016-01-05 23:18:59 +01:00
parent a8402035e9
commit 843e2ad2c1
4 changed files with 54 additions and 12 deletions

View file

@ -1751,6 +1751,9 @@ static struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) {
}
}
// active bar modifiers might have changed.
update_active_bar_modifiers();
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
@ -1775,6 +1778,9 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
if (strcmp(old_mode, bar->mode) != 0) {
if (!config->reading) {
ipc_event_barconfig_update(bar);
// active bar modifiers might have changed.
update_active_bar_modifiers();
}
sway_log(L_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
}