From 9dee4f7a6507242976dcdd4e9b152c1116751901 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 11:55:14 +0200 Subject: [PATCH] WPrefs: fix SIGUSR2 targeting wmaker instead of parent shell The previous getppid() approach sent SIGUSR2 to the terminal process (foot) rather than wmaker, killing the shell. Now wmaker exports WMAKER_PID at startup and wl_send_wm_command reads it to signal the correct process. --- WINGs/wevent_wl.c | 10 ++++++++-- src/main.c | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/WINGs/wevent_wl.c b/WINGs/wevent_wl.c index b1e438c..f2d5822 100644 --- a/WINGs/wevent_wl.c +++ b/WINGs/wevent_wl.c @@ -377,8 +377,14 @@ static void wl_keysym_convert_case(void *ectx, WMNativeKeysym sym, static void wl_send_wm_command(void *ectx, const char *cmd) { (void)ectx; - if (cmd && strcmp(cmd, "Reconfigure") == 0) - kill(getppid(), SIGUSR2); + if (cmd && strcmp(cmd, "Reconfigure") == 0) { + const char *pidstr = getenv("WMAKER_PID"); + if (pidstr) { + pid_t pid = (pid_t)atoi(pidstr); + if (pid > 0) + kill(pid, SIGUSR2); + } + } } static void wl_set_window_hints(void *ectx, WNativeWindow w, diff --git a/src/main.c b/src/main.c index abccfda..36143a2 100644 --- a/src/main.c +++ b/src/main.c @@ -622,6 +622,11 @@ static int real_main(int argc, char **argv) /* for telling WPrefs what's the name of the wmaker binary being ran */ setenv("WMAKER_BIN_NAME", argv[0], 1); + { + char pidbuf[16]; + snprintf(pidbuf, sizeof(pidbuf), "%d", (int)getpid()); + setenv("WMAKER_PID", pidbuf, 1); + } ArgCount = argc; Arguments = wmalloc(sizeof(char *) * (ArgCount + 1));