diff options
author | emersion <contact@emersion.fr> | 2018-10-08 15:08:33 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-10-08 15:08:33 +0200 |
commit | c988b03d85e4c747194a682a40ab1b1e309a2fbe (patch) | |
tree | d790dee3ea65f825f16e89453196c74c4512583b /sway/config/output.c | |
parent | Merge pull request #2791 from RyanDwyer/status-command-optional (diff) | |
download | sway-c988b03d85e4c747194a682a40ab1b1e309a2fbe.tar.gz sway-c988b03d85e4c747194a682a40ab1b1e309a2fbe.tar.zst sway-c988b03d85e4c747194a682a40ab1b1e309a2fbe.zip |
Allow swaybg to be disabled
Diffstat (limited to 'sway/config/output.c')
-rw-r--r-- | sway/config/output.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 6f337b66..2b041353 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -229,17 +229,16 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | if (oc && oc->background) { | 232 | if (output->bg_pid != 0) { |
233 | if (output->bg_pid != 0) { | 233 | terminate_swaybg(output->bg_pid); |
234 | terminate_swaybg(output->bg_pid); | 234 | } |
235 | } | 235 | if (oc && oc->background && config->swaybg_command) { |
236 | |||
237 | wlr_log(WLR_DEBUG, "Setting background for output %d to %s", | 236 | wlr_log(WLR_DEBUG, "Setting background for output %d to %s", |
238 | output_i, oc->background); | 237 | output_i, oc->background); |
239 | 238 | ||
240 | size_t len = snprintf(NULL, 0, "%s %d \"%s\" %s %s", | 239 | size_t len = snprintf(NULL, 0, "%s %d \"%s\" %s %s", |
241 | config->swaybg_command ? config->swaybg_command : "swaybg", | 240 | config->swaybg_command, output_i, oc->background, |
242 | output_i, oc->background, oc->background_option, | 241 | oc->background_option, |
243 | oc->background_fallback ? oc->background_fallback : ""); | 242 | oc->background_fallback ? oc->background_fallback : ""); |
244 | char *command = malloc(len + 1); | 243 | char *command = malloc(len + 1); |
245 | if (!command) { | 244 | if (!command) { |
@@ -247,8 +246,8 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
247 | return; | 246 | return; |
248 | } | 247 | } |
249 | snprintf(command, len + 1, "%s %d \"%s\" %s %s", | 248 | snprintf(command, len + 1, "%s %d \"%s\" %s %s", |
250 | config->swaybg_command ? config->swaybg_command : "swaybg", | 249 | config->swaybg_command, output_i, oc->background, |
251 | output_i, oc->background, oc->background_option, | 250 | oc->background_option, |
252 | oc->background_fallback ? oc->background_fallback : ""); | 251 | oc->background_fallback ? oc->background_fallback : ""); |
253 | wlr_log(WLR_DEBUG, "-> %s", command); | 252 | wlr_log(WLR_DEBUG, "-> %s", command); |
254 | 253 | ||
@@ -260,6 +259,7 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
260 | free(command); | 259 | free(command); |
261 | } | 260 | } |
262 | } | 261 | } |
262 | |||
263 | if (oc) { | 263 | if (oc) { |
264 | switch (oc->dpms_state) { | 264 | switch (oc->dpms_state) { |
265 | case DPMS_ON: | 265 | case DPMS_ON: |
@@ -353,4 +353,3 @@ void create_default_output_configs(void) { | |||
353 | list_add(config->output_configs, oc); | 353 | list_add(config->output_configs, oc); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | |||