commit 424b0fe9257d48604dd4868350af6830f95dbaf4
Author: Ricardo Jesus <[email protected]>
Date:   Mon Feb 10 15:34:49 2020 +0000

    [dwm][patch] swaptags (swap the contents of two tags)

diff --git a/dwm.suckless.org/patches/swaptags/dwm-swaptags-6.2.diff 
b/dwm.suckless.org/patches/swaptags/dwm-swaptags-6.2.diff
new file mode 100644
index 00000000..eb5b5603
--- /dev/null
+++ b/dwm.suckless.org/patches/swaptags/dwm-swaptags-6.2.diff
@@ -0,0 +1,59 @@
+From 66122d908f338538f4af0e09332dec80b90524d8 Mon Sep 17 00:00:00 2001
+From: Ricardo Jesus <[email protected]>
+Date: Sat, 29 Jun 2019 11:48:54 +0100
+Subject: [PATCH] Allow swapping the contents of two tags
+
+---
+ config.def.h | 26 +++++++++++++++++++++++++-
+ 1 file changed, 25 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..701f8da 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -43,13 +43,16 @@ static const Layout layouts[] = {
+       { "[M]",      monocle },
+ };
+ 
++void swaptags(const Arg *arg);
++
+ /* key definitions */
+ #define MODKEY Mod1Mask
+ #define TAGKEYS(KEY,TAG) \
+       { MODKEY,                       KEY,      view,           {.ui = 1 << 
TAG} }, \
+       { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << 
TAG} }, \
+       { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << 
TAG} }, \
+-      { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << 
TAG} },
++      { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << 
TAG} }, \
++      { Mod4Mask|ShiftMask,           KEY,      swaptags,       {.ui = 1 << 
TAG} },
+ 
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+@@ -113,3 +116,24 @@ static Button buttons[] = {
+       { ClkTagBar,            MODKEY,         Button3,        toggletag,      
{0} },
+ };
+ 
++void
++swaptags(const Arg *arg)
++{
++      unsigned int newtag = arg->ui & TAGMASK;
++      unsigned int curtag = selmon->tagset[selmon->seltags];
++
++      if (newtag == curtag || !curtag || (curtag & (curtag-1)))
++              return;
++
++      for (Client *c = selmon->clients; c != NULL; c = c->next) {
++              if((c->tags & newtag) || (c->tags & curtag))
++                      c->tags ^= curtag ^ newtag;
++
++              if(!c->tags) c->tags = newtag;
++      }
++
++      selmon->tagset[selmon->seltags] = newtag;
++
++      focus(NULL);
++      arrange(selmon);
++}
+-- 
+2.22.0
+
diff --git a/dwm.suckless.org/patches/swaptags/index.md 
b/dwm.suckless.org/patches/swaptags/index.md
new file mode 100644
index 00000000..8d8ae586
--- /dev/null
+++ b/dwm.suckless.org/patches/swaptags/index.md
@@ -0,0 +1,15 @@
+swaptags
+========
+
+Description
+-----------
+Allow swapping the contents of the currently selected tag with tag N by
+selecting Mod4+Shift+N.
+
+Download
+--------
+* [dwm-swaptags-6.2.diff](dwm-swaptags-6.2.diff) (1.9K)
+
+Author
+------
+* Ricardo J. Jesus <[email protected]>


Reply via email to