applied Jeroen Schot's shiftview patch e0cfe076
Anselm R. Garbe · 2007-07-24 18:29 3 file(s) · +23 −0
dwm.h +1 −0
144 144
void toggletag(const char *arg);	/* toggles sel tags with arg's index */
145 145
void toggleview(const char *arg);	/* toggles the tag with arg's index (in)visible */
146 146
void view(const char *arg);		/* views the tag with arg's index */
147 +
void shiftview(const char *arg);        /* views next(1)/previous(-1) tag */
147 148
148 149
/* util.c */
149 150
void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
event.c +4 −0
135 135
					else
136 136
						toggleview(buf);
137 137
				}
138 +
				else if(ev->button == Button4)
139 +
					shiftview("-1");
140 +
				else if(ev->button == Button5)
141 +
					shiftview("1");
138 142
				return;
139 143
			}
140 144
		}
tag.c +18 −0
99 99
			c->tags[i] = seltag[i];
100 100
}
101 101
102 +
void 
103 +
shiftview(const char *arg) {
104 +
	int i, j;
105 +
106 +
	for(i = 0; !seltag[i]; i++);
107 +
	for(j = i + 1; j < ntags && !seltag[j]; j++);
108 +
	if(j < ntags)
109 +
		return; /* more then one tag selected */
110 +
	seltag[i] = False;
111 +
	i += arg ? atoi(arg) : 0;
112 +
	if(i < 0)
113 +
		i = ntags - 1;
114 +
	else if(i >= ntags)
115 +
		i = 0;
116 +
	seltag[i] = True;
117 +
	lt->arrange();
118 +
}
119 +
102 120
void
103 121
tag(const char *arg) {
104 122
	int i;