[wiki] [sites] [dwm][patch] dwm-pertag-perseltag fix tag 0 || Aaron Duxler

From: <git_AT_suckless.org>
Date: Mon, 22 Jun 2020 12:57:10 +0200

commit b418122eafecdaa6d913424ca519ec75a62154c4
Author: Aaron Duxler <aaron_AT_duxler.xyz>
Date: Mon Jun 22 12:57:07 2020 +0200

    [dwm][patch] dwm-pertag-perseltag fix tag 0

diff --git a/dwm.suckless.org/patches/pertag/dwm-pertag-perseltag-6.2.diff b/dwm.suckless.org/patches/pertag/dwm-pertag-perseltag-6.2.diff
index 7ccfeb3a..743e7c1c 100644
--- a/dwm.suckless.org/patches/pertag/dwm-pertag-perseltag-6.2.diff
+++ b/dwm.suckless.org/patches/pertag/dwm-pertag-perseltag-6.2.diff
_AT_@ -1,6 +1,6 @@
 diff -up a/dwm.c b/dwm.c
---- a/dwm.c 2020-04-17 13:37:50.926942626 +0200
-+++ b/dwm.c 2020-04-17 13:44:30.578373509 +0200
+--- a/dwm.c 2020-05-23 00:20:34.877944603 +0200
++++ b/dwm.c 2020-06-22 12:49:55.298859682 +0200
 _AT_@ -111,6 +111,7 @@ typedef struct {
          void (*arrange)(Monitor *);
  } Layout;
_AT_@ -62,19 +62,24 @@ diff -up a/dwm.c b/dwm.c
          return m;
  }
  
-_AT_@ -966,7 +992,11 @@ grabkeys(void)
+_AT_@ -966,7 +992,16 @@ grabkeys(void)
  void
  incnmaster(const Arg *arg)
  {
 + unsigned int i;
          selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
-+ for(i=0; i<=LENGTH(tags); ++i)
++ for(i=0; i<LENGTH(tags); ++i)
 + if(selmon->tagset[selmon->seltags] & 1<<i)
-+ selmon->pertag->nmasters[(i+1)%(LENGTH(tags)+1)] = selmon->nmaster;
++ selmon->pertag->nmasters[i+1] = selmon->nmaster;
++
++ if(selmon->pertag->curtag == 0)
++ {
++ selmon->pertag->nmasters[0] = selmon->nmaster;
++ }
          arrange(selmon);
  }
  
-_AT_@ -1500,11 +1530,20 @@ setfullscreen(Client *c, int fullscreen)
+_AT_@ -1500,11 +1535,26 @@ setfullscreen(Client *c, int fullscreen)
  void
  setlayout(const Arg *arg)
  {
_AT_@ -85,17 +90,23 @@ diff -up a/dwm.c b/dwm.c
                  selmon->lt[selmon->sellt] = (Layout *)arg->v;
          strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
 +
-+ for(i=0; i<=LENGTH(tags); ++i)
++ for(i=0; i<LENGTH(tags); ++i)
 + if(selmon->tagset[selmon->seltags] & 1<<i)
 + {
-+ selmon->pertag->ltidxs[(i+1)%(LENGTH(tags)+1)][selmon->sellt] = selmon->lt[selmon->sellt];
-+ selmon->pertag->sellts[(i+1)%(LENGTH(tags)+1)] = selmon->sellt;
++ selmon->pertag->ltidxs[i+1][selmon->sellt] = selmon->lt[selmon->sellt];
++ selmon->pertag->sellts[i+1] = selmon->sellt;
 + }
++
++ if(selmon->pertag->curtag == 0)
++ {
++ selmon->pertag->ltidxs[0][selmon->sellt] = selmon->lt[selmon->sellt];
++ selmon->pertag->sellts[0] = selmon->sellt;
++ }
 +
          if (selmon->sel)
                  arrange(selmon);
          else
-_AT_@ -1516,13 +1555,19 @@ void
+_AT_@ -1516,13 +1566,24 @@ void
  setmfact(const Arg *arg)
  {
          float f;
_AT_@ -104,30 +115,41 @@ diff -up a/dwm.c b/dwm.c
          if (!arg || !selmon->lt[selmon->sellt]->arrange)
                  return;
          f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
+- if (f < 0.1 || f > 0.9)
 + if (arg->f == 0.0)
 + f = mfact;
- if (f < 0.1 || f > 0.9)
++ if (f < 0.05 || f > 0.95)
                  return;
          selmon->mfact = f;
-+ for(i=0; i<=LENGTH(tags); ++i)
++ for(i=0; i<LENGTH(tags); ++i)
 + if(selmon->tagset[selmon->seltags] & 1<<i)
-+ selmon->pertag->mfacts[(i+1)%(LENGTH(tags)+1)] = f;
++ selmon->pertag->mfacts[i+1] = f;
++
++ if(selmon->pertag->curtag == 0)
++ {
++ selmon->pertag->mfacts[0] = f;
++ }
          arrange(selmon);
  }
  
-_AT_@ -1699,7 +1744,11 @@ tile(Monitor *m)
+_AT_@ -1699,7 +1760,16 @@ tile(Monitor *m)
  void
  togglebar(const Arg *arg)
  {
 + unsigned int i;
          selmon->showbar = !selmon->showbar;
-+ for(i=0; i<=LENGTH(tags); ++i)
++ for(i=0; i<LENGTH(tags); ++i)
 + if(selmon->tagset[selmon->seltags] & 1<<i)
-+ selmon->pertag->showbars[(i+1)%(LENGTH(tags)+1)] = selmon->showbar;
++ selmon->pertag->showbars[i+1] = selmon->showbar;
++
++ if(selmon->pertag->curtag == 0)
++ {
++ selmon->pertag->showbars[0] = selmon->showbar;
++ }
          updatebarpos(selmon);
          XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
          arrange(selmon);
-_AT_@ -1738,9 +1787,33 @@ void
+_AT_@ -1738,9 +1808,33 @@ void
  toggleview(const Arg *arg)
  {
          unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
_AT_@ -161,7 +183,7 @@ diff -up a/dwm.c b/dwm.c
                  focus(NULL);
                  arrange(selmon);
          }
-_AT_@ -2035,11 +2108,37 @@ updatewmhints(Client *c)
+_AT_@ -2035,11 +2129,37 @@ updatewmhints(Client *c)
  void
  view(const Arg *arg)
  {
diff --git a/dwm.suckless.org/patches/pertag/index.md b/dwm.suckless.org/patches/pertag/index.md
index b1136796..22ff19d5 100644
--- a/dwm.suckless.org/patches/pertag/index.md
+++ b/dwm.suckless.org/patches/pertag/index.md
_AT_@ -27,7 +27,7 @@ Download
 * With this version of pertag, changes are always applied to all selected tags.
   For exmaple: If tag 2 and tag 3 are selected, changes to barpos, layout, mfact, nmaster will apply to both tags.
   With the original pertag patch, changes only effect the tag which was selected first.
- * [dwm-pertag-perseltag-6.2.diff](dwm-pertag-perseltag-6.2.diff) (20200418)
+ * [dwm-pertag-perseltag-6.2.diff](dwm-pertag-perseltag-6.2.diff) (20200622)
 
 
 Authors
Received on Mon Jun 22 2020 - 12:57:10 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 22 2020 - 13:00:45 CEST