diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-16 19:36:31 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-16 19:36:31 -0500 |
commit | 03787871d078ef8761af74404280ebcc3bfb5770 (patch) | |
tree | 76a81b32e36c401bedbeb0a2748451266ff4fb6b | |
parent | 1a365f19c970ec9f974a6f1d04e4b52677af75e6 (diff) |
Fix bar invocation for multihead setup
-rw-r--r-- | sway/config.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sway/config.c b/sway/config.c index fc9e97ad..970225f4 100644 --- a/sway/config.c +++ b/sway/config.c @@ -398,19 +398,20 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { } } - if (oc && oc->background) { - int i; - for (i = 0; i < root_container.children->length; ++i) { - if (root_container.children->items[i] == output) { - break; - } + int output_i; + for (output_i = 0; output_i < root_container.children->length; ++output_i) { + if (root_container.children->items[output_i] == output) { + break; } + } + + if (oc && oc->background) { - sway_log(L_DEBUG, "Setting background for output %d to %s", i, oc->background); + sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); size_t bufsize = 4; char output_id[bufsize]; - snprintf(output_id, bufsize, "%d", i); + snprintf(output_id, bufsize, "%d", output_i); output_id[bufsize-1] = 0; char *const cmd[] = { @@ -450,11 +451,11 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { } } if (bar) { - sway_log(L_DEBUG, "Invoking swaybar for output %s and bar %s", output->name, bar->id); + sway_log(L_DEBUG, "Invoking swaybar for output %s[%d] and bar %s", output->name, i, bar->id); size_t bufsize = 4; char output_id[bufsize]; - snprintf(output_id, bufsize, "%d", i); + snprintf(output_id, bufsize, "%d", output_i); output_id[bufsize-1] = 0; char *const cmd[] = { |