diff --git a/README.md b/README.md index 5815d8f..53fbb8e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-09-05 - Alpha, systray, togglefullscreen, pertag and zoomswap patches added +2019-09-05 - Alpha, systray, togglefullscreen, tagallmon, tagmonfixfs, tagswapmon, pertag and zoomswap patches added ### Patches included: @@ -24,12 +24,17 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [systray](https://dwm.suckless.org/patches/systray/) - adds system tray in the status bar + - [tagallmon](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagallmon-6.2.diff) + - move all visible windows to an adjacent monitor + - [tagmonfixfs](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagmonfixfs-6.2.diff) - allows moving a fullscreen window to another monitor while remaining in fullscreen + - [tagswapmon](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagswapmon-6.2.diff) + - swap all visible windows on one monitor with those of an adjacent monitor + - [togglefullscreen](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff) - allows you to toggle fullscreen on and off using a single shortcut key - [zoomswap](https://dwm.suckless.org/patches/zoomswap/) - allows a master and a stack window to swap places rather than every window on the screen changing position - diff --git a/config.def.h b/config.def.h index f29f623..a145750 100644 --- a/config.def.h +++ b/config.def.h @@ -102,6 +102,14 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + #if TAGALLMON_PATCH + { MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } }, + #endif // TAGALLMON_PATCH + #if TAGSWAPMON_PATCH + { MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } }, + #endif // TAGSWAPMON_PATCH TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) diff --git a/patch/include.c b/patch/include.c index aa64108..6308352 100644 --- a/patch/include.c +++ b/patch/include.c @@ -10,6 +10,14 @@ #include "systray.c" #endif +#if TAGALLMON_PATCH +#include "tagallmon.c" +#endif + +#if TAGSWAPMON_PATCH +#include "tagswapmon.c" +#endif + #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.c" #endif diff --git a/patch/include.h b/patch/include.h index 972bd4e..a0e7a4b 100644 --- a/patch/include.h +++ b/patch/include.h @@ -6,6 +6,14 @@ #include "systray.h" #endif +#if TAGALLMON_PATCH +#include "tagallmon.h" +#endif + +#if TAGSWAPMON_PATCH +#include "tagswapmon.h" +#endif + #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.h" #endif diff --git a/patch/tagallmon.c b/patch/tagallmon.c new file mode 100644 index 0000000..51af142 --- /dev/null +++ b/patch/tagallmon.c @@ -0,0 +1,31 @@ +void +tagallmon(const Arg *arg) +{ + Monitor *m; + Client *c; + Client *next; + + if (!mons->next) + return; + + m = dirtomon(arg->i); + for (c = selmon->clients; c; c = next) { + next = c->next; + if (!ISVISIBLE(c)) + continue; + unfocus(c, 1); + detach(c); + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ + attach(c); + attachstack(c); + if (c->isfullscreen) { + setfullscreen(c, 0); + setfullscreen(c, 1); + } + } + + focus(NULL); + arrange(NULL); +} \ No newline at end of file diff --git a/patch/tagallmon.h b/patch/tagallmon.h new file mode 100644 index 0000000..e409024 --- /dev/null +++ b/patch/tagallmon.h @@ -0,0 +1 @@ +static void tagallmon(const Arg *arg); \ No newline at end of file diff --git a/patch/tagswapmon.c b/patch/tagswapmon.c new file mode 100644 index 0000000..8779262 --- /dev/null +++ b/patch/tagswapmon.c @@ -0,0 +1,60 @@ +void +tagswapmon(const Arg *arg) +{ + Monitor *m; + Client *c, *sc = NULL, *mc = NULL, *next; + + if (!mons->next) + return; + + m = dirtomon(arg->i); + + for (c = selmon->clients; c; c = next) { + next = c->next; + if (!ISVISIBLE(c)) + continue; + unfocus(c, 1); + detach(c); + detachstack(c); + c->next = sc; + sc = c; + } + + for (c = m->clients; c; c = next) { + next = c->next; + if (!ISVISIBLE(c)) + continue; + unfocus(c, 1); + detach(c); + detachstack(c); + c->next = mc; + mc = c; + } + + for (c = sc; c; c = next) { + next = c->next; + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ + attach(c); + attachstack(c); + if (c->isfullscreen) { + setfullscreen(c, 0); + setfullscreen(c, 1); + } + } + + for (c = mc; c; c = next) { + next = c->next; + c->mon = selmon; + c->tags = selmon->tagset[selmon->seltags]; /* assign tags of target monitor */ + attach(c); + attachstack(c); + if (c->isfullscreen) { + setfullscreen(c, 0); + setfullscreen(c, 1); + } + } + + focus(NULL); + arrange(NULL); +} \ No newline at end of file diff --git a/patch/tagswapmon.h b/patch/tagswapmon.h new file mode 100644 index 0000000..433f4b1 --- /dev/null +++ b/patch/tagswapmon.h @@ -0,0 +1 @@ +static void tagswapmon(const Arg *arg); \ No newline at end of file diff --git a/patches.h b/patches.h index b8a87e3..7f75ff8 100644 --- a/patches.h +++ b/patches.h @@ -28,6 +28,11 @@ */ #define PERTAGBAR_PATCH 0 +/* This patch allows you to move all visible windows on a monitor to an adjacent monitor. + * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagallmon-6.2.diff + */ +#define TAGALLMON_PATCH 0 + /* If you try to send a fullscreen window to an adjacent monitor using tagmon then * the window is moved behind the scenes, but it remains in fullscreen on the original * monitor until you exit fullscreen view (at which point it will appear on the adjacent @@ -37,6 +42,12 @@ */ #define TAGMONFIXFS_PATCH 0 +/* This patch allows you to swap all visible windows on one monitor with those of an + * adjacent monitor. + * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagswapmon-6.2.diff + */ +#define TAGSWAPMON_PATCH 0 + /* This patch allows you to toggle fullscreen on and off using a single shortcut key. * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff */