mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 13:04:11 +01:00
Merge pull request #1866 from ggreer/swaybar-cmd-sh
invoke_swaybar: Set process group id
This commit is contained in:
commit
85ec700206
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
static void terminate_swaybar(pid_t pid) {
|
static void terminate_swaybar(pid_t pid) {
|
||||||
wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
|
wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
|
||||||
int ret = kill(pid, SIGTERM);
|
int ret = kill(-pid, SIGTERM);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
|
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
|
||||||
} else {
|
} else {
|
||||||
@ -163,6 +163,7 @@ void invoke_swaybar(struct bar_config *bar) {
|
|||||||
|
|
||||||
bar->pid = fork();
|
bar->pid = fork();
|
||||||
if (bar->pid == 0) {
|
if (bar->pid == 0) {
|
||||||
|
setpgid(0, 0);
|
||||||
close(filedes[0]);
|
close(filedes[0]);
|
||||||
|
|
||||||
// run custom swaybar
|
// run custom swaybar
|
||||||
@ -172,9 +173,9 @@ void invoke_swaybar(struct bar_config *bar) {
|
|||||||
char *command = malloc(len + 1);
|
char *command = malloc(len + 1);
|
||||||
if (!command) {
|
if (!command) {
|
||||||
const char msg[] = "Unable to allocate swaybar command string";
|
const char msg[] = "Unable to allocate swaybar command string";
|
||||||
size_t len = sizeof(msg);
|
size_t msg_len = sizeof(msg);
|
||||||
if (write(filedes[1], &len, sizeof(int))) {};
|
if (write(filedes[1], &msg_len, sizeof(int))) {};
|
||||||
if (write(filedes[1], msg, len)) {};
|
if (write(filedes[1], msg, msg_len)) {};
|
||||||
close(filedes[1]);
|
close(filedes[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user