MODKEY-Tab is very nice for bouncing between tags, but sometimes I
re-select the current tag using MODKEY-<n> (where <n> is 1-9). Now
both seltags and prevtags contain the same set, meaning that
MODKEY-Tab does nothing useful.

This patch modifies the view() function so that it doesn't change
prevtags unless the new set of tags is different from the old.

I'm a new dwm user, so it's entirely possible that I've missed
something in the zen of it all - feedback appreciated.

dme.
# HG changeset patch
# User David Edmondson <[EMAIL PROTECTED]>
# Date 1201697367 0
# Node ID 5d3dd7a910209317156aef400c7875c71a1ffcbf
# Parent  5cfd3c602edec1519568ebc7f8e443006c239b3b
When switching viewed tags, don't update prevtags unless something
actually changed.

diff --git a/dwm.c b/dwm.c
--- a/dwm.c
+++ b/dwm.c
@@ -1930,14 +1930,19 @@ void
 void
 view(const char *arg) {
 	unsigned int i;
+	Bool tmp[LENGTH(tags)];
 
 	Monitor *m = &monitors[monitorat(-1, -1)];
 
-	memcpy(m->prevtags, m->seltags, sizeof initags);
 	for(i = 0; i < LENGTH(tags); i++)
-		m->seltags[i] = (NULL == arg);
-	m->seltags[idxoftag(arg)] = True;
-	arrange();
+		tmp[i] = (NULL == arg);
+	tmp[idxoftag(arg)] = True;
+
+	if (memcmp(m->seltags, tmp, sizeof initags) != 0) {
+		memcpy(m->prevtags, m->seltags, sizeof initags);
+		memcpy(m->seltags, tmp, sizeof initags);
+		arrange();
+	}
 }
 
 void
dme.
-- 
David Edmondson, http://dme.org

Reply via email to