[dev] [tabbed] [PATCH] select tab with X ClientMessage event

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Thu, 28 Nov 2013 02:24:58 +0100

---
Hello,
this patch allows tabbed to switch to a tab specified in a XCientMessage.
I intend to use this with surf and dmenu to easily switch between tabs when I
have opened more than ten tabs. I already testet it with a draft patch to surf
and probably will send in the finished one later.
--Markus
 tabbed.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tabbed.c b/tabbed.c
index 3a6e7f9..f07322a 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -48,7 +48,7 @@
 
 enum { ColFG, ColBG, ColLast };                         /* color */
 enum { WMProtocols, WMDelete, WMName, WMState, WMFullscreen,
-	XEmbed, WMLast };                               /* default atoms */
+	XEmbed, WMSelectTab, WMLast };                      /* default atoms */
 
 typedef union {
 	int i;
_AT_@ -237,6 +237,9 @@ clientmessage(const XEvent *e) {
 	if(ev->message_type == wmatom[WMProtocols]
 			&& ev->data.l[0] == wmatom[WMDelete]) {
 		running = False;
+	} else if(ev->message_type == wmatom[WMSelectTab]) {
+		Arg a = {.i = ev->data.l[0]};
+		move(&a);
 	}
 }
 
_AT_@ -892,8 +895,8 @@ setup(void) {
 	wmatom[XEmbed] = XInternAtom(dpy, "_XEMBED", False);
 	wmatom[WMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 	wmatom[WMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
-	wmatom[WMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN",
-			False);
+	wmatom[WMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+	wmatom[WMSelectTab] = XInternAtom(dpy, "_TABBED_SELECT_TAB", False);
 
 	/* init appearance */
 	wx = 0;
-- 
1.8.2
Received on Thu Nov 28 2013 - 02:24:58 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 28 2013 - 02:36:06 CET