aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-27 08:18:26 +0100
committerLibravatar GitHub <noreply@github.com>2018-04-27 08:18:26 +0100
commit85ec7002068277fe82dcc139ebb401b515ca5d80 (patch)
tree80e0130a14cca3499fa72c399b3c2825df900e62
parentMerge pull request #1860 from emersion/input-map-from (diff)
parentRename len to msg_len. Avoids an aliased variable that was a little confusing... (diff)
downloadsway-85ec7002068277fe82dcc139ebb401b515ca5d80.tar.gz
sway-85ec7002068277fe82dcc139ebb401b515ca5d80.tar.zst
sway-85ec7002068277fe82dcc139ebb401b515ca5d80.zip
Merge pull request #1866 from ggreer/swaybar-cmd-sh
invoke_swaybar: Set process group id
-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 }