mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
Terminate swaybar when freeing bar config
This commit is contained in:
parent
2719ddfe5e
commit
2e84f21ab7
@ -15,6 +15,16 @@
|
|||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
static void terminate_swaybar(pid_t pid) {
|
||||||
|
int ret = kill(pid, SIGTERM);
|
||||||
|
if (ret != 0) {
|
||||||
|
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
|
||||||
|
} else {
|
||||||
|
int status;
|
||||||
|
waitpid(pid, &status, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void free_bar_config(struct bar_config *bar) {
|
void free_bar_config(struct bar_config *bar) {
|
||||||
if (!bar) {
|
if (!bar) {
|
||||||
return;
|
return;
|
||||||
@ -31,7 +41,7 @@ void free_bar_config(struct bar_config *bar) {
|
|||||||
free_flat_list(bar->outputs);
|
free_flat_list(bar->outputs);
|
||||||
}
|
}
|
||||||
if (bar->pid != 0) {
|
if (bar->pid != 0) {
|
||||||
// TODO terminate_swaybar(bar->pid);
|
terminate_swaybar(bar->pid);
|
||||||
}
|
}
|
||||||
free(bar->colors.background);
|
free(bar->colors.background);
|
||||||
free(bar->colors.statusline);
|
free(bar->colors.statusline);
|
||||||
@ -191,16 +201,6 @@ void invoke_swaybar(struct bar_config *bar) {
|
|||||||
close(filedes[1]);
|
close(filedes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void terminate_swaybar(pid_t pid) {
|
|
||||||
int ret = kill(pid, SIGTERM);
|
|
||||||
if (ret != 0) {
|
|
||||||
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
|
|
||||||
} else {
|
|
||||||
int status;
|
|
||||||
waitpid(pid, &status, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool active_output(const char *name) {
|
static bool active_output(const char *name) {
|
||||||
swayc_t *cont = NULL;
|
swayc_t *cont = NULL;
|
||||||
for (int i = 0; i < root_container.children->length; ++i) {
|
for (int i = 0; i < root_container.children->length; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user