From 156681f0a5af18704faab52929badc671390ec61 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 27 Dec 2017 18:46:18 +0000 Subject: [PATCH] Add support for re-exec'ing with SIGHUP; equivalent to the already built-in 'restart' function. --- calmwm.c | 5 +++++ cwm.1 | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/calmwm.c b/calmwm.c index 521d1f9..d95c206 100644 --- a/calmwm.c +++ b/calmwm.c @@ -82,6 +82,8 @@ main(int argc, char **argv) if (signal(SIGCHLD, sighdlr) == SIG_ERR) err(1, "signal"); + if (signal(SIGHUP, sighdlr) == SIG_ERR) + err(1, "signal"); Conf.homedir = getenv("HOME"); if ((Conf.homedir == NULL) || (Conf.homedir[0] == '\0')) { @@ -221,6 +223,9 @@ sighdlr(int sig) (pid < 0 && errno == EINTR)) ; break; + case SIGHUP: + cwm_status = CWM_EXEC_WM; + break; } errno = save_errno; diff --git a/cwm.1 b/cwm.1 index d81b223..d8ffb07 100644 --- a/cwm.1 +++ b/cwm.1 @@ -184,6 +184,14 @@ List all available items. .It Ic [Esc] Cancel. .El +.Pp +.Nm +rereads its configuration file when it receives a hangup signal, +.Dv SIGHUP , +by executing itself with the name and arguments with which it was started. +This is equivilant to the +.Ar restart +function. .Sh SEARCH .Nm features the ability to search for windows by their current title,