Added ability to deselect ALL tags, removing all windows from view.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 3 Feb 2023 00:15:46 +0000 (16:15 -0800)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 3 Feb 2023 00:15:46 +0000 (16:15 -0800)
config.def.h
config.h
dwm.c

index 5205f64..46333e6 100644 (file)
@@ -5,6 +5,7 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 1;        /* 0 means bottom bar */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 1;        /* 0 means bottom bar */
+static const int startontag         = 1;        /* 0 means no tag active on start */
 static const char *fonts[]          = { "monospace:size=10" };
 static const char dmenufont[]       = "monospace:size=10";
 static const char col_gray1[]       = "#222222";
 static const char *fonts[]          = { "monospace:size=10" };
 static const char dmenufont[]       = "monospace:size=10";
 static const char col_gray1[]       = "#222222";
index 5205f64..46333e6 100644 (file)
--- a/config.h
+++ b/config.h
@@ -5,6 +5,7 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 1;        /* 0 means bottom bar */
 static const unsigned int snap      = 32;       /* snap pixel */
 static const int showbar            = 1;        /* 0 means no bar */
 static const int topbar             = 1;        /* 0 means bottom bar */
+static const int startontag         = 1;        /* 0 means no tag active on start */
 static const char *fonts[]          = { "monospace:size=10" };
 static const char dmenufont[]       = "monospace:size=10";
 static const char col_gray1[]       = "#222222";
 static const char *fonts[]          = { "monospace:size=10" };
 static const char dmenufont[]       = "monospace:size=10";
 static const char col_gray1[]       = "#222222";
diff --git a/dwm.c b/dwm.c
index 6c81540..14fe6cc 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -352,7 +352,9 @@ applyrules(Client *c)
                XFree(ch.res_class);
        if (ch.res_name)
                XFree(ch.res_name);
                XFree(ch.res_class);
        if (ch.res_name)
                XFree(ch.res_name);
-       c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
+       if(c->tags & TAGMASK)                    c->tags = c->tags & TAGMASK;
+       else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags];
+       else                                     c->tags = 1;
 }
 
 int
 }
 
 int
@@ -680,7 +682,7 @@ createmon(void)
        Monitor *m;
 
        m = ecalloc(1, sizeof(Monitor));
        Monitor *m;
 
        m = ecalloc(1, sizeof(Monitor));
-       m->tagset[0] = m->tagset[1] = 1;
+       m->tagset[0] = m->tagset[1] = startontag ? 1 : 0;
        m->mfact = mfact;
        m->nmaster = nmaster;
        m->showbar = showbar;
        m->mfact = mfact;
        m->nmaster = nmaster;
        m->showbar = showbar;
@@ -1464,7 +1466,7 @@ sendmon(Client *c, Monitor *m)
        detach(c);
        detachstack(c);
        c->mon = m;
        detach(c);
        detachstack(c);
        c->mon = m;
-       c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+       c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1);
        attach(c);
        attachstack(c);
        focus(NULL);
        attach(c);
        attachstack(c);
        focus(NULL);
@@ -1784,11 +1786,9 @@ toggleview(const Arg *arg)
 {
        unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
 
 {
        unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
 
-       if (newtagset) {
-               selmon->tagset[selmon->seltags] = newtagset;
-               focus(NULL);
-               arrange(selmon);
-       }
+       selmon->tagset[selmon->seltags] = newtagset;
+       focus(NULL);
+       arrange(selmon);
 }
 
 void
 }
 
 void
@@ -2082,7 +2082,7 @@ updatewmhints(Client *c)
 void
 view(const Arg *arg)
 {
 void
 view(const Arg *arg)
 {
-       if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+       if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
                return;
        selmon->seltags ^= 1; /* toggle sel tagset */
        if (arg->ui & TAGMASK)
                return;
        selmon->seltags ^= 1; /* toggle sel tagset */
        if (arg->ui & TAGMASK)