aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-27 08:18:26 +0100
committerGitHub <noreply@github.com>2018-04-27 08:18:26 +0100
commit85ec7002068277fe82dcc139ebb401b515ca5d80 (patch)
tree80e0130a14cca3499fa72c399b3c2825df900e62 /sway
parent64e0731cc7206e8becfe6f80bc58362aa53f07b6 (diff)
parent5587af1782539e2ea2c762597054a066bc0eeee7 (diff)
Merge pull request #1866 from ggreer/swaybar-cmd-sh
invoke_swaybar: Set process group id
Diffstat (limited to 'sway')
-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 @@
static void terminate_swaybar(pid_t pid) {
wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
- int ret = kill(pid, SIGTERM);
+ int ret = kill(-pid, SIGTERM);
if (ret != 0) {
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
} else {
@@ -163,6 +163,7 @@ void invoke_swaybar(struct bar_config *bar) {
bar->pid = fork();
if (bar->pid == 0) {
+ setpgid(0, 0);
close(filedes[0]);
// run custom swaybar
@@ -172,9 +173,9 @@ void invoke_swaybar(struct bar_config *bar) {
char *command = malloc(len + 1);
if (!command) {
const char msg[] = "Unable to allocate swaybar command string";
- size_t len = sizeof(msg);
- if (write(filedes[1], &len, sizeof(int))) {};
- if (write(filedes[1], msg, len)) {};
+ size_t msg_len = sizeof(msg);
+ if (write(filedes[1], &msg_len, sizeof(int))) {};
+ if (write(filedes[1], msg, msg_len)) {};
close(filedes[1]);
exit(1);
}