diff --git a/README.md b/README.md index 2e0772c..f73f485 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-10-04 - Added maximize, movestack, monoclesymbol, noborder patches +2019-10-04 - Added maximize, movestack, monoclesymbol, noborder and tagall patches 2019-10-03 - Added onlyquitonempty and switchcol patches @@ -197,6 +197,9 @@ 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 + - [tagall](https://dwm.suckless.org/patches/tagall/) + - adds keyboard shortcuts to move all (or only floating) windows from one tag to another + - [tagallmon](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagallmon-6.2.diff) - move all visible windows to an adjacent monitor diff --git a/config.def.h b/config.def.h index 388cdea..5640b51 100644 --- a/config.def.h +++ b/config.def.h @@ -426,6 +426,26 @@ static Key keys[] = { { MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} }, { MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} }, #endif // FOCUSADJACENTTAG_PATCH + #if TAGALL_PATCH + { MODKEY|ShiftMask, XK_F1, tagall, {.v = "F1"} }, + { MODKEY|ShiftMask, XK_F2, tagall, {.v = "F2"} }, + { MODKEY|ShiftMask, XK_F3, tagall, {.v = "F3"} }, + { MODKEY|ShiftMask, XK_F4, tagall, {.v = "F4"} }, + { MODKEY|ShiftMask, XK_F5, tagall, {.v = "F5"} }, + { MODKEY|ShiftMask, XK_F6, tagall, {.v = "F6"} }, + { MODKEY|ShiftMask, XK_F7, tagall, {.v = "F7"} }, + { MODKEY|ShiftMask, XK_F8, tagall, {.v = "F8"} }, + { MODKEY|ShiftMask, XK_F9, tagall, {.v = "F9"} }, + { MODKEY|ControlMask, XK_F1, tagall, {.v = "1"} }, + { MODKEY|ControlMask, XK_F2, tagall, {.v = "2"} }, + { MODKEY|ControlMask, XK_F3, tagall, {.v = "3"} }, + { MODKEY|ControlMask, XK_F4, tagall, {.v = "4"} }, + { MODKEY|ControlMask, XK_F5, tagall, {.v = "5"} }, + { MODKEY|ControlMask, XK_F6, tagall, {.v = "6"} }, + { MODKEY|ControlMask, XK_F7, tagall, {.v = "7"} }, + { MODKEY|ControlMask, XK_F8, tagall, {.v = "8"} }, + { MODKEY|ControlMask, XK_F9, tagall, {.v = "9"} }, + #endif // TAGALL_PATCH #if TAGALLMON_PATCH { MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } }, { MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } }, diff --git a/patch/include.c b/patch/include.c index fa6905c..714e4b4 100644 --- a/patch/include.c +++ b/patch/include.c @@ -98,6 +98,10 @@ #include "switchcol.c" #endif +#if TAGALL_PATCH +#include "tagall.c" +#endif + #if TAGALLMON_PATCH #include "tagallmon.c" #endif diff --git a/patch/include.h b/patch/include.h index f78287d..1cae911 100644 --- a/patch/include.h +++ b/patch/include.h @@ -98,6 +98,10 @@ #include "switchcol.h" #endif +#if TAGALL_PATCH +#include "tagall.h" +#endif + #if TAGALLMON_PATCH #include "tagallmon.h" #endif diff --git a/patch/tagall.c b/patch/tagall.c new file mode 100644 index 0000000..e978aaf --- /dev/null +++ b/patch/tagall.c @@ -0,0 +1,25 @@ +void +tagall(const Arg *arg) +{ + if (!selmon->clients) + return; + /* if parameter starts with F, just move floating windows */ + int floating_only = (char *)arg->v && ((char *)arg->v)[0] == 'F' ? 1 : 0; + int tag = (char *)arg->v ? atoi(((char *)arg->v) + floating_only) : 0; + int j; + Client* c; + if (tag >= 0 && tag < LENGTH(tags)) + for (c = selmon->clients; c; c = c->next) + { + if (!floating_only || c->isfloating) + for (j = 0; j < LENGTH(tags); j++) + { + if (c->tags & 1 << j && selmon->tagset[selmon->seltags] & 1 << j) + { + c->tags = c->tags ^ (1 << j & TAGMASK); + c->tags = c->tags | 1 << (tag-1); + } + } + } + arrange(selmon); +} \ No newline at end of file diff --git a/patch/tagall.h b/patch/tagall.h new file mode 100644 index 0000000..09fe4d1 --- /dev/null +++ b/patch/tagall.h @@ -0,0 +1 @@ +static void tagall(const Arg *arg); \ No newline at end of file diff --git a/patches.h b/patches.h index 6ccee1e..17c5d7a 100644 --- a/patches.h +++ b/patches.h @@ -316,6 +316,11 @@ */ #define SWITCHTAG_PATCH 0 +/* Adds keyboard shortcuts to move all (or only floating) windows from one tag to another. + * https://dwm.suckless.org/patches/tagall/ + */ +#define TAGALL_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 */