summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h2
-rw-r--r--conf.c9
-rw-r--r--cwmrc.54
-rw-r--r--group.c17
-rw-r--r--kbfunc.c6
5 files changed, 38 insertions, 0 deletions
diff --git a/calmwm.h b/calmwm.h
index 88da71a..4c915a8 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -438,6 +438,8 @@ void			 kbfunc_cmdexec(struct client_ctx *, union arg *);
 void			 kbfunc_client_label(struct client_ctx *, union arg *);
 void			 kbfunc_client_delete(struct client_ctx *, union arg *);
 void			 kbfunc_client_group(struct client_ctx *, union arg *);
+void			 kbfunc_client_grouponly(struct client_ctx *,
+			     union arg *);
 void			 kbfunc_client_cyclegroup(struct client_ctx *,
 			     union arg *);
 void			 kbfunc_client_nogroup(struct client_ctx *,
diff --git a/conf.c b/conf.c
index 0e1d4e3..0ae7e68 100644
--- a/conf.c
+++ b/conf.c
@@ -272,6 +272,15 @@ struct {
 	{ "group7", kbfunc_client_group, 0, {.i = 7} },
 	{ "group8", kbfunc_client_group, 0, {.i = 8} },
 	{ "group9", kbfunc_client_group, 0, {.i = 9} },
+	{ "grouponly1", kbfunc_client_grouponly, 0, {.i = 1} },
+	{ "grouponly2", kbfunc_client_grouponly, 0, {.i = 2} },
+	{ "grouponly3", kbfunc_client_grouponly, 0, {.i = 3} },
+	{ "grouponly4", kbfunc_client_grouponly, 0, {.i = 4} },
+	{ "grouponly5", kbfunc_client_grouponly, 0, {.i = 5} },
+	{ "grouponly6", kbfunc_client_grouponly, 0, {.i = 6} },
+	{ "grouponly7", kbfunc_client_grouponly, 0, {.i = 7} },
+	{ "grouponly8", kbfunc_client_grouponly, 0, {.i = 8} },
+	{ "grouponly9", kbfunc_client_grouponly, 0, {.i = 9} },
 	{ "nogroup", kbfunc_client_nogroup, 0, {0} },
 	{ "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLEGROUP} },
 	{ "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLEGROUP} },
diff --git a/cwmrc.5 b/cwmrc.5
index 7b0ce5c..c0740b5 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -242,6 +242,10 @@ Launch
 menu.
 .It group[n]
 Select group n, where n is 1-9.
+.It grouponly[n]
+Like
+.Ar group[n]
+but also hides the other groups.
 .It nogroup
 Select all groups.
 .It grouptoggle
diff --git a/group.c b/group.c
index 29647ac..73f742d 100644
--- a/group.c
+++ b/group.c
@@ -213,6 +213,23 @@ group_hidetoggle(int idx)
 	}
 }
 
+void
+group_only(int idx)
+{
+	int	 i;
+
+	if (idx < 0 || idx >= CALMWM_NGROUPS)
+		err(1, "group_only: index out of range (%d)", idx);
+
+	for (i = 0; i < CALMWM_NGROUPS; i++) {
+		if (i == idx) {
+			_group_show(&Groups[i]);
+		} else {
+			_group_hide(&Groups[i]);
+		}
+	}
+}
+
 /*
  * Cycle through active groups.  If none exist, then just stay put.
  */
diff --git a/kbfunc.c b/kbfunc.c
index 74d5e00..e05a3b5 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -439,6 +439,12 @@ kbfunc_client_group(struct client_ctx *cc, union arg *arg)
 }
 
 void
+kbfunc_client_grouponly(struct client_ctx *cc, union arg *arg)
+{
+	group_only(KBTOGROUP(arg->i));
+}
+
+void
 kbfunc_client_cyclegroup(struct client_ctx *cc, union arg *arg)
 {
 	group_cycle(arg->i);