summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h2
-rw-r--r--conf.c1
-rw-r--r--cwmrc.52
-rw-r--r--group.c3
-rw-r--r--kbfunc.c8
-rw-r--r--screen.c1
6 files changed, 17 insertions, 0 deletions
diff --git a/calmwm.h b/calmwm.h
index 9ae2afe..17bd55a 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -214,6 +214,7 @@ struct screen_ctx {
 	struct region_q		 regionq;
 	struct group_q		 groupq;
 	struct group_ctx	*group_active;
+	struct group_ctx	*group_last;
 	Colormap		 colormap;
 	Visual			*visual;
 	struct {
@@ -501,6 +502,7 @@ void			 kbfunc_client_toggle_group(void *, struct cargs *);
 void			 kbfunc_client_movetogroup(void *, struct cargs *);
 void			 kbfunc_group_toggle(void *, struct cargs *);
 void			 kbfunc_group_only(void *, struct cargs *);
+void			 kbfunc_group_last(void *, struct cargs *);
 void			 kbfunc_group_close(void *, struct cargs *);
 void			 kbfunc_group_cycle(void *, struct cargs *);
 void			 kbfunc_group_toggle_all(void *, struct cargs *);
diff --git a/conf.c b/conf.c
index 246b4b0..ce8e954 100644
--- a/conf.c
+++ b/conf.c
@@ -139,6 +139,7 @@ static const struct {
 
 	{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
 	{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
+	{ FUNC_SC(group-last, group_last, 0) },
 	{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
 	{ FUNC_SC(group-toggle-1, group_toggle, 1) },
 	{ FUNC_SC(group-toggle-2, group_toggle, 2) },
diff --git a/cwmrc.5 b/cwmrc.5
index ab70d25..7075288 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -273,6 +273,8 @@ menu.
 Toggle visibility of group n, where n is 1-9.
 .It group-only-[n]
 Show only group n, where n is 1-9, hiding other groups.
+.It group-last
+Show only the previously active group.
 .It group-close-[n]
 Close all windows in group n, where n is 1-9.
 .It group-toggle-all
diff --git a/group.c b/group.c
index de55211..3246936 100644
--- a/group.c
+++ b/group.c
@@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int idx)
 {
 	struct group_ctx	*gc;
 
+	if (sc->group_last != sc->group_active)
+		sc->group_last = sc->group_active;
+
 	TAILQ_FOREACH(gc, &sc->groupq, entry) {
 		if (gc->num == idx)
 			group_show(gc);
diff --git a/kbfunc.c b/kbfunc.c
index cbccc56..70eafd6 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct cargs *cargs)
 }
 
 void
+kbfunc_group_last(void *ctx, struct cargs *cargs)
+{
+	struct screen_ctx	*sc = ctx;
+
+	group_only(ctx, sc->group_last->num);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
 	group_toggle(ctx, cargs->flag);
diff --git a/screen.c b/screen.c
index 373ff71..e880e97 100644
--- a/screen.c
+++ b/screen.c
@@ -60,6 +60,7 @@ screen_init(int which)
 	xu_ewmh_net_supported_wm_check(sc);
 
 	conf_group(sc);
+	sc->group_last = sc->group_active;
 	screen_update_geometry(sc);
 
 	xu_ewmh_net_desktop_names(sc);