aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-01-06 07:26:54 -0500
committerDrew DeVault <sir@cmpwn.com>2016-01-06 07:26:54 -0500
commit8f5de70c93b2afaab0dd7d384c58ff3d3007193c (patch)
tree4826eca48ec5d4d2b827477c74de7d500f39f0fa /sway/config.c
parent18f81850114af1ca969387e0715d9284e77b0148 (diff)
parent843e2ad2c140288733110691f7dc8252fbe4dc16 (diff)
Merge pull request #434 from mikkeloscar/detect-modifier
Send IPC modifier event on bar_modifier up/down
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index 1973de02..95d8f339 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -103,6 +103,8 @@ static void free_config(struct sway_config *config) {
free_output_config(config->output_configs->items[i]);
}
list_free(config->output_configs);
+
+ list_free(config->active_bar_modifiers);
free(config);
}
@@ -145,6 +147,33 @@ static void config_defaults(struct sway_config *config) {
config->edge_gaps = true;
config->gaps_inner = 0;
config->gaps_outer = 0;
+
+ config->active_bar_modifiers = create_list();
+}
+
+static int compare_modifiers(const void *left, const void *right) {
+ uint32_t a = *(uint32_t *)left;
+ uint32_t b = *(uint32_t *)right;
+
+ return a - b;
+}
+
+void update_active_bar_modifiers() {
+ if (config->active_bar_modifiers->length > 0) {
+ list_free(config->active_bar_modifiers);
+ config->active_bar_modifiers = create_list();
+ }
+
+ struct bar_config *bar;
+ int i;
+ for (i = 0; i < config->bars->length; ++i) {
+ bar = config->bars->items[i];
+ if (strcmp(bar->mode, "hide") == 0 && strcmp(bar->hidden_state, "hide") == 0) {
+ if (list_seq_find(config->active_bar_modifiers, compare_modifiers, &bar->modifier) < 0) {
+ list_add(config->active_bar_modifiers, &bar->modifier);
+ }
+ }
+ }
}
static char *get_config_path(void) {
@@ -215,6 +244,8 @@ bool load_config(const char *file) {
}
fclose(f);
+ update_active_bar_modifiers();
+
return config_load_success;
}
@@ -695,7 +726,7 @@ struct bar_config *default_bar_config(void) {
bar = malloc(sizeof(struct bar_config));
bar->mode = strdup("dock");
bar->hidden_state = strdup("hide");
- bar->modifier = 0;
+ bar->modifier = WLC_BIT_MOD_LOGO;
bar->outputs = NULL;
bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
bar->bindings = create_list();