summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authorokan <okan>2019-03-01 14:32:01 +0000
committerokan <okan>2019-03-01 14:32:01 +0000
commit9d252184582d96dd916bc97675d6a35a18921140 (patch)
tree4fd49cdda69bfc79ad66c3d305b2a001e74b0efb /conf.c
parentae231f67d0ac54fb6281831c10972cc2f1f37acf (diff)
downloadcwm-9d252184582d96dd916bc97675d6a35a18921140.tar.gz
cwm-9d252184582d96dd916bc97675d6a35a18921140.tar.xz
cwm-9d252184582d96dd916bc97675d6a35a18921140.zip
Tie group number and name together during config.
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index e54f96a..d6b0dd1 100644
--- a/conf.c
+++ b/conf.c
@@ -36,6 +36,21 @@ static const char	*conf_bind_getmask(const char *, unsigned int *);
 static void		 conf_unbind_key(struct conf *, struct bind_ctx *);
 static void		 conf_unbind_mouse(struct conf *, struct bind_ctx *);
 
+static const struct {
+	int		 num;
+	const char	*name;
+} group_binds[] = {
+	{ 0, "nogroup" },
+	{ 1, "one" },
+	{ 2, "two" },
+	{ 3, "three" },
+	{ 4, "four" },
+	{ 5, "five" },
+	{ 6, "six" },
+	{ 7, "seven" },
+	{ 8, "eight" },
+	{ 9, "nine" },
+};
 static int cursor_binds[] = {
 	XC_left_ptr,		/* CF_NORMAL */
 	XC_fleur,		/* CF_MOVE */
@@ -266,7 +281,7 @@ conf_init(struct conf *c)
 	c->bwidth = 1;
 	c->mamount = 1;
 	c->snapdist = 0;
-	c->ngroups = 10;
+	c->ngroups = 0;
 	c->nameqlen = 5;
 
 	TAILQ_INIT(&c->ignoreq);
@@ -502,6 +517,17 @@ conf_screen(struct screen_ctx *sc)
 	conf_grab_kbd(sc->rootwin);
 }
 
+void
+conf_group(struct screen_ctx *sc)
+{
+	unsigned int	 i;
+
+	for (i = 0; i < nitems(group_binds); i++) {
+		group_init(sc, group_binds[i].num, group_binds[i].name);
+		Conf.ngroups++;
+	}
+}
+
 static const char *
 conf_bind_getmask(const char *name, unsigned int *mask)
 {