summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/config/bar.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 2913f059..5a97c3cc 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -17,7 +17,7 @@
17 17
18static void terminate_swaybar(pid_t pid) { 18static void terminate_swaybar(pid_t pid) {
19 wlr_log(L_DEBUG, "Terminating swaybar %d", pid); 19 wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
20 int ret = kill(pid, SIGTERM); 20 int ret = kill(-pid, SIGTERM);
21 if (ret != 0) { 21 if (ret != 0) {
22 wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid); 22 wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
23 } else { 23 } else {
@@ -163,6 +163,7 @@ void invoke_swaybar(struct bar_config *bar) {
163 163
164 bar->pid = fork(); 164 bar->pid = fork();
165 if (bar->pid == 0) { 165 if (bar->pid == 0) {
166 setpgid(0, 0);
166 close(filedes[0]); 167 close(filedes[0]);
167 168
168 // run custom swaybar 169 // run custom swaybar
@@ -172,9 +173,9 @@ void invoke_swaybar(struct bar_config *bar) {
172 char *command = malloc(len + 1); 173 char *command = malloc(len + 1);
173 if (!command) { 174 if (!command) {
174 const char msg[] = "Unable to allocate swaybar command string"; 175 const char msg[] = "Unable to allocate swaybar command string";
175 size_t len = sizeof(msg); 176 size_t msg_len = sizeof(msg);
176 if (write(filedes[1], &len, sizeof(int))) {}; 177 if (write(filedes[1], &msg_len, sizeof(int))) {};
177 if (write(filedes[1], msg, len)) {}; 178 if (write(filedes[1], msg, msg_len)) {};
178 close(filedes[1]); 179 close(filedes[1]);
179 exit(1); 180 exit(1);
180 } 181 }