From 477bca5e288cc3155c536265272490b413328778 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 19 Dec 2018 03:21:41 -0500 Subject: [PATCH] Terminate swaybg in output_disable Moves the call to `terminate_swaybg` from inside `apply_output_config` to `output_disable`. The former was only called when an output was being disabled. The latter is called when an output is being disabled and when an output becomes disconnected. Without this, disconnecting an enabled output would result in a defunct swaybg process. --- sway/config/output.c | 4 ---- sway/tree/output.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sway/config/output.c b/sway/config/output.c index 7c2df6ec..f24e7d66 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -179,10 +179,6 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { if (oc && oc->enabled == 0) { if (output->enabled) { - if (output->bg_pid != 0) { - terminate_swaybg(output->bg_pid); - output->bg_pid = 0; - } output_disable(output); wlr_output_layout_remove(root->output_layout, wlr_output); } diff --git a/sway/tree/output.c b/sway/tree/output.c index 6ff95579..95ab9378 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -225,6 +225,11 @@ void output_disable(struct sway_output *output) { root_for_each_container(untrack_output, output); + if (output->bg_pid) { + terminate_swaybg(output->bg_pid); + output->bg_pid = 0; + } + int index = list_find(root->outputs, output); list_del(root->outputs, index);