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.
This commit is contained in:
Window Maker 2026-05-25 11:55:14 +02:00
parent 35226c8588
commit 9dee4f7a65
2 changed files with 13 additions and 2 deletions

View File

@ -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,

View File

@ -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));