summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h1
-rw-r--r--client.c1
-rw-r--r--conf.c2
-rw-r--r--cwm.14
-rw-r--r--kbfunc.c10
-rw-r--r--xevents.c6
6 files changed, 23 insertions, 1 deletions
diff --git a/calmwm.h b/calmwm.h
index 5c06257..f420f6d 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -434,6 +434,7 @@ void			 kbfunc_client_group(struct client_ctx *, void *);
 void			 kbfunc_client_nextgroup(struct client_ctx *, void *);
 void			 kbfunc_client_prevgroup(struct client_ctx *, void *);
 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_quit_wm(struct client_ctx *, void *);
diff --git a/client.c b/client.c
index 17023c9..dd50601 100644
--- a/client.c
+++ b/client.c
@@ -438,6 +438,7 @@ client_unhide(struct client_ctx *cc)
 	XMapWindow(X_Dpy, cc->win);
 	XMapRaised(X_Dpy, cc->pwin);
 
+	cc->highlight = 0;
 	cc->flags &= ~CLIENT_HIDDEN;
 	xu_setstate(cc, NormalState);
 }
diff --git a/conf.c b/conf.c
index 7d59e2f..ff5d29c 100644
--- a/conf.c
+++ b/conf.c
@@ -117,6 +117,7 @@ conf_init(struct conf *c)
 	conf_bindname(c, "CM-9", "group9");
 	conf_bindname(c, "M-Right", "nextgroup");
 	conf_bindname(c, "M-Left", "prevgroup");
+	conf_bindname(c, "CM-g", "grouptoggle");
 	conf_bindname(c, "CM-f", "maximize");
 	conf_bindname(c, "CM-equal", "vmaximize");
 	conf_bindname(c, "CMS-q", "quit");
@@ -224,6 +225,7 @@ struct {
 	{ "nogroup", kbfunc_client_nogroup, 0, 0 },
 	{ "nextgroup", kbfunc_client_nextgroup, 0, 0 },
 	{ "prevgroup", kbfunc_client_prevgroup, 0, 0 },
+	{ "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0},
 	{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
 	{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
 	{ "quit", kbfunc_quit_wm, 0, 0 },
diff --git a/cwm.1 b/cwm.1
index 3429817..8c38f43 100644
--- a/cwm.1
+++ b/cwm.1
@@ -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: April 8 2008 $
+.Dd $Mdocdate: April 15 2008 $
 .Dt CWM 1
 .Os
 .Sh NAME
@@ -83,6 +83,8 @@ Delete current window.
 Select group n, where n is 1-9.
 .It Ic C-M-0
 Select all groups.
+.It Ic C-M-g
+Toggle a window's membership in the current group.
 .It Ic M-Right
 Switch to next group.
 .It Ic M-Left
diff --git a/kbfunc.c b/kbfunc.c
index a6e0da5..a55402a 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -430,6 +430,16 @@ kbfunc_client_nogroup(struct client_ctx *cc, void *arg)
 }
 
 void
+kbfunc_client_grouptoggle(struct client_ctx *cc, void *arg)
+{
+	/* XXX for stupid X apps like xpdf and gvim */
+	XGrabKeyboard(X_Dpy, cc->pwin, True,
+	    GrabModeAsync, GrabModeAsync, CurrentTime);
+
+	group_sticky_toggle_enter(cc);
+}
+
+void
 kbfunc_client_maximize(struct client_ctx *cc, void *arg)
 {
 	client_maximize(cc);
diff --git a/xevents.c b/xevents.c
index f668961..ca3c0d9 100644
--- a/xevents.c
+++ b/xevents.c
@@ -408,6 +408,7 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee)
 {
 	XKeyEvent *e = &ee->xkey;
 	struct screen_ctx *sc = screen_fromroot(e->root);
+	struct client_ctx *cc = client_current();
 	int keysym;
 
 	keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
@@ -422,6 +423,11 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee)
 	 */
 	client_mtf(NULL);
 
+	if (cc != NULL) {
+		group_sticky_toggle_exit(cc);
+		XUngrabKeyboard(X_Dpy, CurrentTime);
+	}
+
 out:
 	xev_register(xev);
 }