From 0c88a49e27fd0888c81aea5dd3eef1c537164a6a Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 6 Apr 2021 12:47:38 +0200 Subject: [PATCH] Adding distributetags patch --- README.md | 5 +++++ config.def.h | 3 +++ patch/distributetags.c | 16 ++++++++++++++++ patch/distributetags.h | 1 + patch/include.c | 3 +++ patch/include.h | 3 +++ patches.def.h | 6 ++++++ 7 files changed, 37 insertions(+) create mode 100644 patch/distributetags.c create mode 100644 patch/distributetags.h diff --git a/README.md b/README.md index 1046497..e069760 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: +2021-04-06 - Added the distributetags patch + 2021-04-04 - Added option for having different gaps on a per tag basis 2021-03-31 - Added tapresize patch (contributed by [verschmelzen](https://github.com/verschmelzen)) @@ -282,6 +284,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - some applications use this property to notify window managers to not draw window decorations - not respecting this property leads to issues with applications that draw their own borders, like chromium (with "Use system title bar and borders" turned off) or vlc in fullscreen mode + - [distributetags](https://dwm.suckless.org/patches/reorganizetags/) + - this reorganisetags variant re-distributes all clients on the current monitor evenly across all tags + - [dmenumatchtop](https://dwm.suckless.org/patches/dmenumatchtop) - updates the position of dmenu to match that of the bar - i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at the top diff --git a/config.def.h b/config.def.h index 5d5ad6f..1ac028c 100644 --- a/config.def.h +++ b/config.def.h @@ -869,6 +869,9 @@ static Key keys[] = { #if REORGANIZETAGS_PATCH { MODKEY|ControlMask, XK_r, reorganizetags, {0} }, #endif // REORGANIZETAGS_PATCH + #if DISTRIBUTETAGS_PATCH + { MODKEY|ControlMask, XK_d, distributetags, {0} }, + #endif // DISTRIBUTETAGS_PATCH #if INSETS_PATCH { MODKEY|ShiftMask|ControlMask, XK_a, updateinset, {.v = &default_inset } }, #endif // INSETS_PATCH diff --git a/patch/distributetags.c b/patch/distributetags.c new file mode 100644 index 0000000..252eb8f --- /dev/null +++ b/patch/distributetags.c @@ -0,0 +1,16 @@ +void +distributetags(const Arg *arg) +{ + unsigned int ui = 1; + int i = 0; + for (Client *c = selmon->clients; c; c = c->next) { + if (HIDDEN(c)) + continue; + if (!(c->tags & TAGMASK)) + continue; + c->tags = (ui << i) & TAGMASK; + i = (i + 1) % NUMTAGS; + } + focus(NULL); + arrange(selmon); +} \ No newline at end of file diff --git a/patch/distributetags.h b/patch/distributetags.h new file mode 100644 index 0000000..5221050 --- /dev/null +++ b/patch/distributetags.h @@ -0,0 +1 @@ +static void distributetags(const Arg *arg); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 02ba47b..9e93ded 100644 --- a/patch/include.c +++ b/patch/include.c @@ -112,6 +112,9 @@ #if DECORATION_HINTS_PATCH #include "decorationhints.c" #endif +#if DISTRIBUTETAGS_PATCH +#include "distributetags.c" +#endif #if DRAGCFACT_PATCH && CFACTS_PATCH #include "dragcfact.c" #endif diff --git a/patch/include.h b/patch/include.h index 7aab494..5cf6e70 100644 --- a/patch/include.h +++ b/patch/include.h @@ -109,6 +109,9 @@ #if DECORATION_HINTS_PATCH #include "decorationhints.h" #endif +#if DISTRIBUTETAGS_PATCH +#include "distributetags.h" +#endif #if DRAGCFACT_PATCH && CFACTS_PATCH #include "dragcfact.h" #endif diff --git a/patches.def.h b/patches.def.h index 16fb791..472d535 100644 --- a/patches.def.h +++ b/patches.def.h @@ -445,6 +445,12 @@ */ #define DECORATION_HINTS_PATCH 0 +/* This feature distributes all clients on the current monitor evenly across all tags. + * It is a variant of the reorganizetags patch. + * https://dwm.suckless.org/patches/reorganizetags/ + */ +#define DISTRIBUTETAGS_PATCH 0 + /* Similarly to the dragmfact patch this allows you to click and drag clients to change the * cfact to adjust the client's size in the stack. This patch depends on the cfacts patch. */