commit 5d2b8ff7195f20921bfdd9ee42a639ab0cb65425
Author: Aaron Duxler <[email protected]>
Date:   Thu Oct 1 19:17:03 2020 +0200

    [dwm][patch] remove broken and unmaintained swapfocus patch

diff --git a/dwm.suckless.org/patches/swapfocus/dwm-swapfocus-6.2.diff 
b/dwm.suckless.org/patches/swapfocus/dwm-swapfocus-6.2.diff
deleted file mode 100644
index d29d7b47..00000000
--- a/dwm.suckless.org/patches/swapfocus/dwm-swapfocus-6.2.diff
+++ /dev/null
@@ -1,208 +0,0 @@
-diff -up a/config.def.h b/config.def.h
---- a/config.def.h     2020-01-29 00:06:12.415681126 +0100
-+++ b/config.def.h     2020-01-29 13:25:14.167910093 +0100
-@@ -66,6 +66,7 @@ static Key keys[] = {
-       { MODKEY,                       XK_b,      togglebar,      {0} },
-       { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
-       { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
-+      { MODKEY,                       XK_s,      swapfocus,      {.i = -1 } },
-       { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
-       { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
-       { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} 
},
-diff -up a/dwm.c b/dwm.c
---- a/dwm.c    2020-01-29 00:06:12.419014466 +0100
-+++ b/dwm.c    2020-01-29 13:27:20.012744075 +0100
-@@ -111,6 +111,7 @@ typedef struct {
-       void (*arrange)(Monitor *);
- } Layout;
- 
-+typedef struct Pertag Pertag;
- struct Monitor {
-       char ltsymbol[16];
-       float mfact;
-@@ -130,6 +131,7 @@ struct Monitor {
-       Monitor *next;
-       Window barwin;
-       const Layout *lt[2];
-+      Pertag *pertag;
- };
- 
- typedef struct {
-@@ -206,6 +208,7 @@ static void seturgent(Client *c, int urg
- static void showhide(Client *c);
- static void sigchld(int unused);
- static void spawn(const Arg *arg);
-+static void swapfocus(const Arg *arg);
- static void tag(const Arg *arg);
- static void tagmon(const Arg *arg);
- static void tile(Monitor *);
-@@ -271,6 +274,11 @@ static Window root, wmcheckwin;
- /* configuration, allows nested code to access above variables */
- #include "config.h"
- 
-+struct Pertag {
-+      unsigned int curtag, prevtag; /* current and previous tag */
-+      Client *prevclient[LENGTH(tags) + 1];
-+};
-+
- /* compile-time check if all tags fit into an unsigned int bit array. */
- struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
- 
-@@ -641,6 +649,8 @@ createmon(void)
-       m->lt[0] = &layouts[0];
-       m->lt[1] = &layouts[1 % LENGTH(layouts)];
-       strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
-+      m->pertag = ecalloc(1, sizeof(Pertag));
-+      m->pertag->curtag = m->pertag->prevtag = 1;
-       return m;
- }
- 
-@@ -1012,6 +1022,7 @@ killclient(const Arg *arg)
-               XSetErrorHandler(xerror);
-               XUngrabServer(dpy);
-       }
-+      selmon->pertag->prevclient[selmon->pertag->curtag] = NULL;
- }
- 
- void
-@@ -1653,11 +1664,41 @@ spawn(const Arg *arg)
- }
- 
- void
-+swapfocus(const Arg *arg)
-+{
-+      if (!selmon->sel)
-+              return;
-+      if(selmon->pertag->prevclient[selmon->pertag->curtag] != NULL 
-+                      && 
ISVISIBLE(selmon->pertag->prevclient[selmon->pertag->curtag])){
-+              focus(selmon->pertag->prevclient[selmon->pertag->curtag]);
-+              
restack(selmon->pertag->prevclient[selmon->pertag->curtag]->mon);
-+      }
-+      else{
-+              Client *c = NULL;
-+              for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
-+              if (!c)
-+                      for (c = selmon->clients; c && !ISVISIBLE(c); c = 
c->next);
-+              if (c) {
-+                      focus(c);
-+                      restack(selmon);
-+              }
-+      }
-+}
-+
-+void
- tag(const Arg *arg)
- {
-+      unsigned int tagmask, tagindex;
-+
-       if (selmon->sel && arg->ui & TAGMASK) {
-               selmon->sel->tags = arg->ui & TAGMASK;
-               focus(NULL);
-+              
-+              selmon->pertag->prevclient[selmon->pertag->curtag] = NULL;
-+              for(tagmask = arg->ui & TAGMASK, tagindex = 1; tagmask!=0; 
tagmask >>= 1, tagindex++)
-+                      if(tagmask & 1)
-+                              selmon->pertag->prevclient[tagindex] = NULL;
-+              
-               arrange(selmon);
-       }
- }
-@@ -1722,7 +1763,7 @@ togglefloating(const Arg *arg)
- void
- toggletag(const Arg *arg)
- {
--      unsigned int newtags;
-+      unsigned int newtags, tagmask, tagindex;
- 
-       if (!selmon->sel)
-               return;
-@@ -1730,6 +1771,11 @@ toggletag(const Arg *arg)
-       if (newtags) {
-               selmon->sel->tags = newtags;
-               focus(NULL);
-+              
-+              for(tagmask = arg->ui & TAGMASK, tagindex = 1; tagmask!=0; 
tagmask >>= 1, tagindex++)
-+                      if(tagmask & 1)
-+                              selmon->pertag->prevclient[tagindex] = NULL;
-+              
-               arrange(selmon);
-       }
- }
-@@ -1738,9 +1784,22 @@ void
- toggleview(const Arg *arg)
- {
-       unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & 
TAGMASK);
-+      int i;
- 
-       if (newtagset) {
-               selmon->tagset[selmon->seltags] = newtagset;
-+
-+              if (newtagset == ~0) {
-+                      selmon->pertag->prevtag = selmon->pertag->curtag;
-+                      selmon->pertag->curtag = 0;
-+              }
-+
-+              /* test if the user did not select the same tag */
-+              if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
-+                      selmon->pertag->prevtag = selmon->pertag->curtag;
-+                      for (i = 0; !(newtagset & 1 << i); i++) ;
-+                      selmon->pertag->curtag = i + 1;
-+              }
-               focus(NULL);
-               arrange(selmon);
-       }
-@@ -1751,6 +1810,7 @@ unfocus(Client *c, int setfocus)
- {
-       if (!c)
-               return;
-+      selmon->pertag->prevclient[selmon->pertag->curtag] = c;
-       grabbuttons(c, 0);
-       XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
-       if (setfocus) {
-@@ -2035,12 +2095,30 @@ updatewmhints(Client *c)
- void
- view(const Arg *arg)
- {
-+      int i;
-+      unsigned int tmptag;
-+
-       if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
-               return;
-       selmon->seltags ^= 1; /* toggle sel tagset */
--      if (arg->ui & TAGMASK)
-+      if (arg->ui & TAGMASK){
-               selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
-+              selmon->pertag->prevtag = selmon->pertag->curtag;
-+
-+              if (arg->ui == ~0)
-+                      selmon->pertag->curtag = 0;
-+              else {
-+                      for (i = 0; !(arg->ui & 1 << i); i++) ;
-+                      selmon->pertag->curtag = i + 1;
-+              }
-+      } else {
-+              tmptag = selmon->pertag->prevtag;
-+              selmon->pertag->prevtag = selmon->pertag->curtag;
-+              selmon->pertag->curtag = tmptag;
-+      }
-+      Client *unmodified = selmon->pertag->prevclient[selmon->pertag->curtag];
-       focus(NULL);
-+      selmon->pertag->prevclient[selmon->pertag->curtag] = unmodified;
-       arrange(selmon);
- }
- 
-@@ -2114,12 +2192,13 @@ void
- zoom(const Arg *arg)
- {
-       Client *c = selmon->sel;
-+      selmon->pertag->prevclient[selmon->pertag->curtag] = 
nexttiled(selmon->clients);
- 
-       if (!selmon->lt[selmon->sellt]->arrange
-       || (selmon->sel && selmon->sel->isfloating))
-               return;
-       if (c == nexttiled(selmon->clients))
--              if (!c || !(c = nexttiled(c->next)))
-+              if (!c || !(c = 
selmon->pertag->prevclient[selmon->pertag->curtag] = nexttiled(c->next)))
-                       return;
-       pop(c);
- }
diff --git a/dwm.suckless.org/patches/swapfocus/index.md 
b/dwm.suckless.org/patches/swapfocus/index.md
index 10a6c41f..5d48d3fc 100644
--- a/dwm.suckless.org/patches/swapfocus/index.md
+++ b/dwm.suckless.org/patches/swapfocus/index.md
@@ -7,15 +7,8 @@ This patch makes it possible to switch focus with one single 
shortcut (alt-s)
 instead of having to think if you should use alt-j or alt-k for reaching the
 last used window.
 
-Changes in 6.2
-----------------
-* Remember the previous tag and previous clients on each tag.
-* If there is no previous client on the current tag (because it was moved or 
killed), 
-  the next client on the current tag is focused.
-
 Download
 --------
-* [dwm-swapfocus-6.2.diff](dwm-swapfocus-6.2.diff) (2020-01-29)
 * [dwm-swapfocus-20160731-56a31dc.diff](dwm-swapfocus-20160731-56a31dc.diff)
 * [dwm-swapfocus-6.0.diff](dwm-swapfocus-6.0.diff) (1482b) (2012-04-06)
 * [dwm-5.8.2-swap.diff](dwm-5.8.2-swap.diff) (dwm 5.8.2)
@@ -24,4 +17,3 @@ Author
 ------
 * Lasse Engblom
 * Jan Christoph Ebersbach - <[email protected]>
-* Aaron Duxler - <[email protected]> (6.2 port)


Reply via email to