added heretag command which allows to tag a client of a foreign tag with current tag 4f8b08d3
Anselm R. Garbe · 2006-07-18 11:38 6 file(s) · +42 −10
client.c +4 −4
66 66
	if(!sel)
67 67
		return;
68 68
69 -
	if(!(c = getnext(sel->next)))
70 -
		c = getnext(clients);
69 +
	if(!(c = getnext(sel->next, tsel)))
70 +
		c = getnext(clients, tsel);
71 71
	if(c) {
72 72
		higher(c);
73 73
		c->revert = sel;
410 410
	if(!sel)
411 411
		return;
412 412
413 -
	if(sel == getnext(clients) && sel->next)  {
414 -
		if((c = getnext(sel->next)))
413 +
	if(sel == getnext(clients, tsel) && sel->next)  {
414 +
		if((c = getnext(sel->next, tsel)))
415 415
			sel = c;
416 416
	}
417 417
draw.c +1 −1
97 97
{
98 98
	Client *c;
99 99
100 -
	for(c = clients; c; c = getnext(c->next))
100 +
	for(c = clients; c; c = getnext(c->next, tsel))
101 101
		drawtitle(c);
102 102
	drawstatus();
103 103
}
dwm.1 +8 −0
93 93
tag to current
94 94
.B window
95 95
.TP
96 +
.B Control-Shift-[0..n]
97 +
Replace current
98 +
.B window
99 +
of
100 +
.B nth
101 +
tag with current tag.
102 +
.B window
103 +
.TP
96 104
.B Control-Button1
97 105
Zooms the clicked
98 106
.B window
dwm.h +2 −1
145 145
extern void appendtag(Arg *arg);
146 146
extern void dofloat(Arg *arg);
147 147
extern void dotile(Arg *arg);
148 -
extern Client *getnext(Client *c);
148 +
extern Client *getnext(Client *c, unsigned int t);
149 +
extern void heretag(Arg *arg);
149 150
extern void replacetag(Arg *arg);
150 151
extern void settags(Client *c);
151 152
extern void view(Arg *arg);
event.c +4 −0
35 35
	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
36 36
	{ Mod1Mask,				XK_space,	dotile,		{ 0 } }, 
37 37
	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
38 +
	{ ControlMask|ShiftMask,XK_0,		heretag,	{ .i = Tscratch } }, 
39 +
	{ ControlMask|ShiftMask,XK_1,		heretag,	{ .i = Tdev } }, 
40 +
	{ ControlMask|ShiftMask,XK_2,		heretag,	{ .i = Twww } }, 
41 +
	{ ControlMask|ShiftMask,XK_3,		heretag,	{ .i = Twork } }, 
38 42
	{ Mod1Mask|ShiftMask,	XK_0,		replacetag,		{ .i = Tscratch } }, 
39 43
	{ Mod1Mask|ShiftMask,	XK_1,		replacetag,		{ .i = Tdev } }, 
40 44
	{ Mod1Mask|ShiftMask,	XK_2,		replacetag,		{ .i = Twww } }, 
tag.c +23 −4
49 49
			ban(c);
50 50
	}
51 51
	if(sel && !sel->tags[tsel]) {
52 -
		if((sel = getnext(clients))) {
52 +
		if((sel = getnext(clients, tsel))) {
53 53
			higher(sel);
54 54
			focus(sel);
55 55
		}
106 106
			ban(c);
107 107
	}
108 108
	if(!sel || (sel && !sel->tags[tsel])) {
109 -
		if((sel = getnext(clients))) {
109 +
		if((sel = getnext(clients, tsel))) {
110 110
			higher(sel);
111 111
			focus(sel);
112 112
		}
115 115
}
116 116
117 117
Client *
118 -
getnext(Client *c)
118 +
getnext(Client *c, unsigned int t)
119 119
{
120 -
	for(; c && !c->tags[tsel]; c = c->next);
120 +
	for(; c && !c->tags[t]; c = c->next);
121 121
	return c;
122 +
}
123 +
124 +
void
125 +
heretag(Arg *arg)
126 +
{
127 +
	int i;
128 +
	Client *c;
129 +
130 +
	if(arg->i == tsel)
131 +
		return;
132 +
133 +
	if(!(c = getnext(clients, arg->i)))
134 +
		return;
135 +
136 +
	for(i = 0; i < TLast; i++)
137 +
		c->tags[i] = NULL;
138 +
	c->tags[tsel] = tags[tsel];
139 +
	arrange(NULL);
140 +
	focus(c);
122 141
}
123 142
124 143
void