summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2017-12-27 18:46:18 +0000
committerokan <okan>2017-12-27 18:46:18 +0000
commit156681f0a5af18704faab52929badc671390ec61 (patch)
tree5030567a69c472f466a2386debc8512802050b95
parent3d7c82936e6cbc49c92cdd985f8c3a8588028da5 (diff)
downloadcwm-156681f0a5af18704faab52929badc671390ec61.tar.gz
cwm-156681f0a5af18704faab52929badc671390ec61.tar.xz
cwm-156681f0a5af18704faab52929badc671390ec61.zip
Add support for re-exec'ing with SIGHUP; equivalent to the already built-in
'restart' function.
-rw-r--r--calmwm.c5
-rw-r--r--cwm.18
2 files changed, 13 insertions, 0 deletions
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,