added heretag command which allows to tag a client of a foreign tag with current tag
authorAnselm R. Garbe <garbeam@wmii.de>
Tue, 18 Jul 2006 11:38:31 +0200
changeset 93 c498da7520c7
parent 92 4bee0aa5b286
child 94 6efe82c775c9
added heretag command which allows to tag a client of a foreign tag with current tag
client.c
draw.c
dwm.1
dwm.h
event.c
tag.c
--- a/client.c	Tue Jul 18 08:18:54 2006 +0200
+++ b/client.c	Tue Jul 18 11:38:31 2006 +0200
@@ -66,8 +66,8 @@
 	if(!sel)
 		return;
 
-	if(!(c = getnext(sel->next)))
-		c = getnext(clients);
+	if(!(c = getnext(sel->next, tsel)))
+		c = getnext(clients, tsel);
 	if(c) {
 		higher(c);
 		c->revert = sel;
@@ -410,8 +410,8 @@
 	if(!sel)
 		return;
 
-	if(sel == getnext(clients) && sel->next)  {
-		if((c = getnext(sel->next)))
+	if(sel == getnext(clients, tsel) && sel->next)  {
+		if((c = getnext(sel->next, tsel)))
 			sel = c;
 	}
 
--- a/draw.c	Tue Jul 18 08:18:54 2006 +0200
+++ b/draw.c	Tue Jul 18 11:38:31 2006 +0200
@@ -97,7 +97,7 @@
 {
 	Client *c;
 
-	for(c = clients; c; c = getnext(c->next))
+	for(c = clients; c; c = getnext(c->next, tsel))
 		drawtitle(c);
 	drawstatus();
 }
--- a/dwm.1	Tue Jul 18 08:18:54 2006 +0200
+++ b/dwm.1	Tue Jul 18 11:38:31 2006 +0200
@@ -93,6 +93,14 @@
 tag to current
 .B window
 .TP
+.B Control-Shift-[0..n]
+Replace current
+.B window
+of
+.B nth
+tag with current tag.
+.B window
+.TP
 .B Control-Button1
 Zooms the clicked
 .B window
--- a/dwm.h	Tue Jul 18 08:18:54 2006 +0200
+++ b/dwm.h	Tue Jul 18 11:38:31 2006 +0200
@@ -145,7 +145,8 @@
 extern void appendtag(Arg *arg);
 extern void dofloat(Arg *arg);
 extern void dotile(Arg *arg);
-extern Client *getnext(Client *c);
+extern Client *getnext(Client *c, unsigned int t);
+extern void heretag(Arg *arg);
 extern void replacetag(Arg *arg);
 extern void settags(Client *c);
 extern void view(Arg *arg);
--- a/event.c	Tue Jul 18 08:18:54 2006 +0200
+++ b/event.c	Tue Jul 18 11:38:31 2006 +0200
@@ -35,6 +35,10 @@
 	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
 	{ Mod1Mask,				XK_space,	dotile,		{ 0 } }, 
 	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
+	{ ControlMask|ShiftMask,XK_0,		heretag,	{ .i = Tscratch } }, 
+	{ ControlMask|ShiftMask,XK_1,		heretag,	{ .i = Tdev } }, 
+	{ ControlMask|ShiftMask,XK_2,		heretag,	{ .i = Twww } }, 
+	{ ControlMask|ShiftMask,XK_3,		heretag,	{ .i = Twork } }, 
 	{ Mod1Mask|ShiftMask,	XK_0,		replacetag,		{ .i = Tscratch } }, 
 	{ Mod1Mask|ShiftMask,	XK_1,		replacetag,		{ .i = Tdev } }, 
 	{ Mod1Mask|ShiftMask,	XK_2,		replacetag,		{ .i = Twww } }, 
--- a/tag.c	Tue Jul 18 08:18:54 2006 +0200
+++ b/tag.c	Tue Jul 18 11:38:31 2006 +0200
@@ -49,7 +49,7 @@
 			ban(c);
 	}
 	if(sel && !sel->tags[tsel]) {
-		if((sel = getnext(clients))) {
+		if((sel = getnext(clients, tsel))) {
 			higher(sel);
 			focus(sel);
 		}
@@ -106,7 +106,7 @@
 			ban(c);
 	}
 	if(!sel || (sel && !sel->tags[tsel])) {
-		if((sel = getnext(clients))) {
+		if((sel = getnext(clients, tsel))) {
 			higher(sel);
 			focus(sel);
 		}
@@ -115,10 +115,29 @@
 }
 
 Client *
-getnext(Client *c)
+getnext(Client *c, unsigned int t)
+{
+	for(; c && !c->tags[t]; c = c->next);
+	return c;
+}
+
+void
+heretag(Arg *arg)
 {
-	for(; c && !c->tags[tsel]; c = c->next);
-	return c;
+	int i;
+	Client *c;
+
+	if(arg->i == tsel)
+		return;
+
+	if(!(c = getnext(clients, arg->i)))
+		return;
+
+	for(i = 0; i < TLast; i++)
+		c->tags[i] = NULL;
+	c->tags[tsel] = tags[tsel];
+	arrange(NULL);
+	focus(c);
 }
 
 void