diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sway/config.c b/sway/config.c index 23fe5388..928d35a8 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -389,7 +389,7 @@ static void invoke_swaybar(swayc_t *output, struct bar_config *bar, int output_i | |||
389 | list_add(output->bar_pids, pid); | 389 | list_add(output->bar_pids, pid); |
390 | } | 390 | } |
391 | 391 | ||
392 | static void terminate_swaybars(list_t *pids) { | 392 | void terminate_swaybars(list_t *pids) { |
393 | int i, ret; | 393 | int i, ret; |
394 | pid_t *pid; | 394 | pid_t *pid; |
395 | for (i = 0; i < pids->length; ++i) { | 395 | for (i = 0; i < pids->length; ++i) { |
@@ -411,6 +411,16 @@ static void terminate_swaybars(list_t *pids) { | |||
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | void terminate_swaybg(pid_t pid) { | ||
415 | int ret = kill(pid, SIGTERM); | ||
416 | if (ret != 0) { | ||
417 | sway_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid); | ||
418 | } else { | ||
419 | int status; | ||
420 | waitpid(pid, &status, 0); | ||
421 | } | ||
422 | } | ||
423 | |||
414 | void load_swaybars(swayc_t *output, int output_idx) { | 424 | void load_swaybars(swayc_t *output, int output_idx) { |
415 | // Check for bars | 425 | // Check for bars |
416 | list_t *bars = create_list(); | 426 | list_t *bars = create_list(); |
@@ -496,13 +506,7 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
496 | if (oc && oc->background) { | 506 | if (oc && oc->background) { |
497 | 507 | ||
498 | if (output->bg_pid != 0) { | 508 | if (output->bg_pid != 0) { |
499 | int ret = kill(output->bg_pid, SIGTERM); | 509 | terminate_swaybg(output->bg_pid); |
500 | if (ret != 0) { | ||
501 | sway_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", output->bg_pid); | ||
502 | } else { | ||
503 | int status; | ||
504 | waitpid(output->bg_pid, &status, 0); | ||
505 | } | ||
506 | } | 510 | } |
507 | 511 | ||
508 | sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); | 512 | sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); |