sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit f54efcf561dd526ac3b3e31f25ff46dc32c78904
parent bdd14427aaaa40ada736dc2d457c33cc6cf57440
Author: Philip Thomas Kanianthara <philip.kanianthara@gmail.com>
Date:   Thu, 14 Mar 2024 10:04:26 +0800

[dwm][patch][toggleallmons] Add patch

Diffstat:
Adwm.suckless.org/patches/toggleallmons/dwm-toggleallmons-6.4.diff | 46++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/toggleallmons/dwm-toggleallmonspertag-6.4.diff | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/toggleallmons/index.md | 22++++++++++++++++++++++
3 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/toggleallmons/dwm-toggleallmons-6.4.diff b/dwm.suckless.org/patches/toggleallmons/dwm-toggleallmons-6.4.diff @@ -0,0 +1,46 @@ +diff --git a/config.def.h b/config.def.h +index 061ad66..d702080 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -72,6 +72,7 @@ static const Key keys[] = { + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, ++ { MODKEY|ShiftMask, XK_Tab, toggleall, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, +diff --git a/dwm.c b/dwm.c +index e5efb6a..f01009f 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -210,6 +210,7 @@ static void spawn(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *m); ++static void toggleall(const Arg *arg); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); + static void toggletag(const Arg *arg); +@@ -1694,6 +1695,21 @@ tile(Monitor *m) + } + } + ++void ++toggleall(const Arg *arg) ++{ ++ Monitor* m; ++ for(m = mons; m; m = m->next){ ++ if ((arg->ui & TAGMASK) == m->tagset[m->seltags]) ++ return; ++ m->seltags ^= 1; /* toggle sel tagset */ ++ if (arg->ui & TAGMASK) ++ m->tagset[m->seltags] = arg->ui & TAGMASK; ++ focus(NULL); ++ arrange(m); ++ } ++} ++ + void + togglebar(const Arg *arg) + { diff --git a/dwm.suckless.org/patches/toggleallmons/dwm-toggleallmonspertag-6.4.diff b/dwm.suckless.org/patches/toggleallmons/dwm-toggleallmonspertag-6.4.diff @@ -0,0 +1,74 @@ +diff --git a/config.def.h b/config.def.h +index 061ad66..67afc6d 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -71,6 +71,7 @@ static const Key keys[] = { + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, ++ { MODKEY|ShiftMask, XK_Tab, toggleall, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, +diff --git a/dwm.c b/dwm.c +index e5efb6a..62f711b 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -210,6 +210,7 @@ static void spawn(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *m); ++static void toggleall(const Arg *arg); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); + static void toggletag(const Arg *arg); +@@ -1694,6 +1695,49 @@ tile(Monitor *m) + } + } + ++ ++void ++toggleall(const Arg *arg) ++{ ++ int i; ++ unsigned int tmptag; ++ ++ Monitor* m; ++ for(m = mons; m; m = m->next){ ++ ++ if ((arg->ui & TAGMASK) == m->tagset[m->seltags]) ++ return; ++ m->seltags ^= 1; /* toggle sel tagset */ ++ if (arg->ui & TAGMASK) { ++ m->tagset[m->seltags] = arg->ui & TAGMASK; ++ m->pertag->prevtag = m->pertag->curtag; ++ ++ if (arg->ui == ~0) ++ m->pertag->curtag = 0; ++ else { ++ for (i = 0; !(arg->ui & 1 << i); i++) ; ++ m->pertag->curtag = i + 1; ++ } ++ } else { ++ tmptag = m->pertag->prevtag; ++ m->pertag->prevtag = m->pertag->curtag; ++ m->pertag->curtag = tmptag; ++ } ++ ++ m->nmaster = m->pertag->nmasters[m->pertag->curtag]; ++ m->mfact = m->pertag->mfacts[m->pertag->curtag]; ++ m->sellt = m->pertag->sellts[m->pertag->curtag]; ++ m->lt[m->sellt] = m->pertag->ltidxs[m->pertag->curtag][m->sellt]; ++ m->lt[m->sellt^1] = m->pertag->ltidxs[m->pertag->curtag][m->sellt^1]; ++ ++ if (m->showbar != m->pertag->showbars[m->pertag->curtag]) ++ togglebar(NULL); ++ ++ focus(NULL); ++ arrange(m); ++ } ++} ++ + void + togglebar(const Arg *arg) + { diff --git a/dwm.suckless.org/patches/toggleallmons/index.md b/dwm.suckless.org/patches/toggleallmons/index.md @@ -0,0 +1,22 @@ +toggleallmons +==================== + +Description +----------- +This patch provides a keybinding to toggle the tagsets for all of your monitors at the same time. + +Press MOD + Shift + Tab to toggle tagsets for all monitors. + +This patch works by creating a new function that wraps the meat of the `view` function in a for loop that iterates through all the monitors, while changing all instances of `selmon` to the name of the iterating variable. + +There are two patches provided, one for the base 6.4 release, and one for those who want to use pertag in conjuction. +Note that to use the pertag variant, you must already have applied the pertag patch. + +Download +-------- +* [dwm-toggleallmons-6.4.diff](dwm-toggleallmons-6.4.diff) - 2024-03-14 +* [dwm-toggleallmonspertag-6.4.diff](dwm-toggleallmonspertag-6.4.diff) - 2024-03-14 + +Author +------ +* Philip Thomas K. - <philtomk@gmail.com>