diff options
Diffstat (limited to 'sway/config.c')
-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) { | |||
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | if (oc && oc->background) { | 401 | int output_i; |
402 | int i; | 402 | for (output_i = 0; output_i < root_container.children->length; ++output_i) { |
403 | for (i = 0; i < root_container.children->length; ++i) { | 403 | if (root_container.children->items[output_i] == output) { |
404 | if (root_container.children->items[i] == output) { | 404 | break; |
405 | break; | ||
406 | } | ||
407 | } | 405 | } |
406 | } | ||
407 | |||
408 | if (oc && oc->background) { | ||
408 | 409 | ||
409 | sway_log(L_DEBUG, "Setting background for output %d to %s", i, oc->background); | 410 | sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); |
410 | 411 | ||
411 | size_t bufsize = 4; | 412 | size_t bufsize = 4; |
412 | char output_id[bufsize]; | 413 | char output_id[bufsize]; |
413 | snprintf(output_id, bufsize, "%d", i); | 414 | snprintf(output_id, bufsize, "%d", output_i); |
414 | output_id[bufsize-1] = 0; | 415 | output_id[bufsize-1] = 0; |
415 | 416 | ||
416 | char *const cmd[] = { | 417 | char *const cmd[] = { |
@@ -450,11 +451,11 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
450 | } | 451 | } |
451 | } | 452 | } |
452 | if (bar) { | 453 | if (bar) { |
453 | sway_log(L_DEBUG, "Invoking swaybar for output %s and bar %s", output->name, bar->id); | 454 | sway_log(L_DEBUG, "Invoking swaybar for output %s[%d] and bar %s", output->name, i, bar->id); |
454 | 455 | ||
455 | size_t bufsize = 4; | 456 | size_t bufsize = 4; |
456 | char output_id[bufsize]; | 457 | char output_id[bufsize]; |
457 | snprintf(output_id, bufsize, "%d", i); | 458 | snprintf(output_id, bufsize, "%d", output_i); |
458 | output_id[bufsize-1] = 0; | 459 | output_id[bufsize-1] = 0; |
459 | 460 | ||
460 | char *const cmd[] = { | 461 | char *const cmd[] = { |