aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2008-07-11 15:18:29 +0000
committerokan2008-07-11 15:18:29 +0000
commitf641857dbaf77d21a1236e9b70e11bf913262cf4 (patch)
tree4b8681b18f07f3f01d5aa107341a712953ee6430
parent5f9e4ce44645e6d431d71a004550c38b08e03525 (diff)
downloadcwm-f641857dbaf77d21a1236e9b70e11bf913262cf4.tar.gz
no more hidden (and mysterious) config reloads and allow binding a key
to a config reload; CMS-r by default. ok oga@
-rw-r--r--calmwm.h4
-rw-r--r--conf.c24
-rw-r--r--cwm.16
-rw-r--r--cwmrc.56
-rw-r--r--kbfunc.c12
-rw-r--r--mousefunc.c4
6 files changed, 21 insertions, 35 deletions
diff --git a/calmwm.h b/calmwm.h
index de70f55..31d4373 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.58 2008/07/11 14:21:28 okan Exp $
+ * $Id: calmwm.h,v 1.59 2008/07/11 15:18:29 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -425,7 +425,6 @@ void conf_unbind(struct conf *, struct keybinding *);
void conf_mousebind(struct conf *, char *, char *);
void conf_mouseunbind(struct conf *, struct mousebinding *);
void conf_grab_mouse(struct client_ctx *);
-int conf_changed(char *);
void conf_reload(struct conf *);
void conf_font(struct conf *);
@@ -444,6 +443,7 @@ void kbfunc_client_nogroup(struct client_ctx *, void *);
void kbfunc_client_grouptoggle(struct client_ctx *, void *);
void kbfunc_client_maximize(struct client_ctx *, void *);
void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_reload(struct client_ctx *, void *);
void kbfunc_quit_wm(struct client_ctx *, void *);
void kbfunc_moveresize(struct client_ctx *, void *);
void kbfunc_menu_search(struct client_ctx *, void *);
diff --git a/conf.c b/conf.c
index 6be7b5a..3883e4b 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: conf.c,v 1.48 2008/07/11 14:24:34 okan Exp $
+ * $Id: conf.c,v 1.49 2008/07/11 15:18:29 okan Exp $
*/
#include "headers.h"
@@ -61,29 +61,9 @@ conf_font(struct conf *c)
c->FontHeight = font_ascent() + font_descent() + 1;
}
-int
-conf_changed(char *path)
-{
- static struct timespec old_ts;
- struct stat sb;
- int changed;
-
- /* If the file does not exist we pretend that nothing changed */
- if (stat(path, &sb) == -1 || !(sb.st_mode & S_IFREG))
- return (0);
-
- changed = !timespeccmp(&sb.st_mtimespec, &old_ts, ==);
- old_ts = sb.st_mtimespec;
-
- return (changed);
-}
-
void
conf_reload(struct conf *c)
{
- if (!conf_changed(c->conf_path))
- return;
-
if (parse_config(c->conf_path, c) == -1) {
warnx("config file %s has errors, not reloading", c->conf_path);
return;
@@ -132,6 +112,7 @@ conf_init(struct conf *c)
conf_bindname(c, "CM-g", "grouptoggle");
conf_bindname(c, "CM-f", "maximize");
conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CMS-r", "reload");
conf_bindname(c, "CMS-q", "quit");
conf_bindname(c, "M-h", "moveleft");
@@ -254,6 +235,7 @@ struct {
{ "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0},
{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "reload", kbfunc_reload, 0, 0 },
{ "quit", kbfunc_quit_wm, 0, 0 },
{ "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
{ "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
diff --git a/cwm.1 b/cwm.1
index 7e13786..9dbb804 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.33 2008/06/25 22:44:42 oga Exp $
+.\" $OpenBSD: cwm.1,v 1.34 2008/07/11 15:18:29 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The following requests are required for all man pages.
-.Dd $Mdocdate: June 25 2008 $
+.Dd $Mdocdate: July 11 2008 $
.Dt CWM 1
.Os
.Sh NAME
@@ -112,6 +112,8 @@ Spawn
dialog; allows you to switch from
.Nm
to another window manager without restarting the X server.
+.It Ic C-M-S-r
+Reload configuration.
.It Ic C-M-S-q
Quit cwm.
.El
diff --git a/cwmrc.5 b/cwmrc.5
index 4fc2a0b..0588be1 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.14 2008/06/25 22:44:42 oga Exp $
+.\" $OpenBSD: cwmrc.5,v 1.15 2008/07/11 15:18:29 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The following requests are required for all man pages.
-.Dd $Mdocdate: June 25 2008 $
+.Dd $Mdocdate: July 11 2008 $
.Dt CWMRC 5
.Os
.Sh NAME
@@ -206,6 +206,8 @@ mousebind M-3 window_resize
.Ed
.Sh BIND COMMAND LIST
.Bl -tag -width 18n -compact
+.It reload
+reload configuration
.It quit
quit
.Xr cwm 1
diff --git a/kbfunc.c b/kbfunc.c
index e9f6f07..a7c9acd 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: kbfunc.c,v 1.31 2008/07/11 14:21:28 okan Exp $
+ * $Id: kbfunc.c,v 1.32 2008/07/11 15:18:29 okan Exp $
*/
#include <paths.h>
@@ -168,7 +168,6 @@ kbfunc_menu_search(struct client_ctx *scratch, void *arg)
TAILQ_INIT(&menuq);
- conf_reload(&Conf);
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
XCALLOC(mi, struct menu);
strlcpy(mi->text, cmd->label, sizeof(mi->text));
@@ -215,14 +214,12 @@ kbfunc_cmdexec(struct client_ctx *cc, void *arg)
void
kbfunc_term(struct client_ctx *cc, void *arg)
{
- conf_reload(&Conf);
u_spawn(Conf.termpath);
}
void
kbfunc_lock(struct client_ctx *cc, void *arg)
{
- conf_reload(&Conf);
u_spawn(Conf.lockpath);
}
@@ -393,7 +390,6 @@ kbfunc_ssh(struct client_ctx *scratch, void *arg)
if ((mi = menu_filter(&menuq, "ssh", NULL, 1,
search_match_exec, NULL)) != NULL) {
- conf_reload(&Conf);
l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
mi->text);
if (l != -1 && l < sizeof(cmd))
@@ -482,3 +478,9 @@ kbfunc_quit_wm(struct client_ctx *cc, void *arg)
{
_xev_quit = 1;
}
+
+void
+kbfunc_reload(struct client_ctx *cc, void *arg)
+{
+ conf_reload(&Conf);
+}
diff --git a/mousefunc.c b/mousefunc.c
index e0b6b57..a38fdd7 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: mousefunc.c,v 1.3 2008/07/11 14:21:28 okan Exp $
+ * $Id: mousefunc.c,v 1.4 2008/07/11 15:18:29 okan Exp $
*/
#include "headers.h"
@@ -113,8 +113,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
struct menu_q menuq;
struct cmd *cmd;
- conf_reload(&Conf);
-
TAILQ_INIT(&menuq);
TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
XCALLOC(mi, struct menu);