Adding swaptags patch

pull/32/head
bakkeby 4 years ago
parent 8cb609fa1e
commit 90a848d608

@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-02-11 - Added swaptags patch
2020-02-09 - Added alternative scratchpad patch
2020-02-02 - Added fsignal and transferall patches
@ -313,6 +315,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [swapfocus](https://dwm.suckless.org/patches/swapfocus/)
- this patch depends on the pertag patch and makes it possible to switch focus with a single shortcut (mod-s) instead of having to think if you should use mod-j or mod-k for reaching the previously used window
- [swaptags](https://dwm.suckless.org/patches/swaptags/)
- allows swapping the contents of the currently selected tag with another tag by using keyboard shortcuts
- [switchcol](https://dwm.suckless.org/patches/switchcol/)
- allows you to switch focus between the master and stack columns using a single keybinding

@ -514,13 +514,15 @@ static const Layout layouts[] = {
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
#else
#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} }, \
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
#endif // COMBO_PATCH
#if HOLDBAR_PATCH

@ -113,6 +113,9 @@
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.c"
#endif
#if SWAPTAGS_PATCH
#include "swaptags.c"
#endif
#if SWITCHCOL_PATCH
#include "switchcol.c"
#endif

@ -113,6 +113,9 @@
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.h"
#endif
#if SWAPTAGS_PATCH
#include "swaptags.h"
#endif
#if SWITCHCOL_PATCH
#include "switchcol.h"
#endif

@ -0,0 +1,22 @@
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);
}

@ -0,0 +1 @@
static void swaptags(const Arg *arg);

@ -468,6 +468,12 @@
*/
#define SWAPFOCUS_PATCH 0
/* This patch allows swapping the contents of the currently selected tag with another tag using
* keyboard shortcuts.
* https://dwm.suckless.org/patches/swaptags/
*/
#define SWAPTAGS_PATCH 0
/* Switch focus between the master and stack columns using a single keybinding.
* https://dwm.suckless.org/patches/switchcol/
*/

Loading…
Cancel
Save