JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
removed viewnext/viewprev
[dwm.git] / tag.c
diff --git a/tag.c b/tag.c
index 3e89569..d27d91a 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -181,7 +181,7 @@ isvisible(Client *c)
        unsigned int i;
 
        for(i = 0; i < ntags; i++)
-               if(c->tags[i] && tsel[i])
+               if(c->tags[i] && seltag[i])
                        return True;
        return False;
 }
@@ -229,7 +229,7 @@ settags(Client *c)
        }
        if(!matched)
                for(i = 0; i < ntags; i++)
-                       c->tags[i] = tsel[i];
+                       c->tags[i] = seltag[i];
 }
 
 void
@@ -245,28 +245,21 @@ view(Arg *arg)
        unsigned int i;
 
        for(i = 0; i < ntags; i++)
-               tsel[i] = False;
-       tsel[arg->i] = True;
+               seltag[i] = False;
+       seltag[arg->i] = True;
        arrange(NULL);
        drawall();
 }
 
 void
-viewnext(Arg *arg)
+toggleview(Arg *arg)
 {
        unsigned int i;
 
-       for(i = 0; !tsel[i]; i++);
-       arg->i = (i < ntags-1) ? i+1 : 0;
-       view(arg);
-}
-
-void
-viewprev(Arg *arg)
-{
-       unsigned int i;
-
-       for(i = 0; !tsel[i]; i++);
-       arg->i = (i > 0) ? i-1 : ntags-1;
-       view(arg);
+       seltag[arg->i] = !seltag[arg->i];
+       for(i = 0; !seltag[i] && i < ntags; i++);
+       if(i == ntags)
+               seltag[arg->i] = True; /* cannot toggle last view */
+       arrange(NULL);
+       drawall();
 }