diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-10 19:26:13 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-10 19:26:13 +0530 |
commit | f2558593e41a462b7137954c1b27d79fa42851aa (patch) | |
tree | 66492c33b1f2036f33c49511fe13087ea21ad23d /patches | |
parent | 7480d87d40d87334419946d3bbf659ded262d81d (diff) |
patched dwm-swaptags-6.2.diff
Diffstat (limited to 'patches')
-rw-r--r-- | patches/dwm-fullgaps-6.4.diff | 94 | ||||
-rw-r--r-- | patches/dwm-swaptags-6.2.diff | 68 |
2 files changed, 162 insertions, 0 deletions
diff --git a/patches/dwm-fullgaps-6.4.diff b/patches/dwm-fullgaps-6.4.diff new file mode 100644 index 0000000..dc52139 --- /dev/null +++ b/patches/dwm-fullgaps-6.4.diff @@ -0,0 +1,94 @@ +diff -up a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,7 @@ + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int gappx = 5; /* gaps between windows */ + static const unsigned int snap = 32; /* snap pixel */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ +@@ -85,6 +86,9 @@ static const Key keys[] = { + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, ++ { MODKEY, XK_minus, setgaps, {.i = -1 } }, ++ { MODKEY, XK_equal, setgaps, {.i = +1 } }, ++ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) +diff -up a/dwm.c b/dwm.c +--- a/dwm.c 2023-04-30 ++++ b/dwm.c 2023-04-30 +@@ -119,6 +119,7 @@ struct Monitor { + int by; /* bar geometry */ + int mx, my, mw, mh; /* screen size */ + int wx, wy, ww, wh; /* window area */ ++ int gappx; /* gaps between windows */ + unsigned int seltags; + unsigned int sellt; + unsigned int tagset[2]; +@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor * + static void setclientstate(Client *c, long state); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); ++static void setgaps(const Arg *arg); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); + static void setup(void); +@@ -641,6 +643,7 @@ createmon(void) + m->nmaster = nmaster; + m->showbar = showbar; + m->topbar = topbar; ++ m->gappx = gappx; + m->lt[0] = &layouts[0]; + m->lt[1] = &layouts[1 % LENGTH(layouts)]; + strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); +@@ -1508,6 +1511,16 @@ setfullscreen(Client *c, int fullscreen) + } + + void ++setgaps(const Arg *arg) ++{ ++ if ((arg->i == 0) || (selmon->gappx + arg->i < 0)) ++ selmon->gappx = 0; ++ else ++ selmon->gappx += arg->i; ++ arrange(selmon); ++} ++ ++void + setlayout(const Arg *arg) + { + if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) +@@ -1697,18 +1710,18 @@ tile(Monitor *m) + if (n > m->nmaster) + mw = m->nmaster ? m->ww * m->mfact : 0; + else +- mw = m->ww; +- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) +- if (i < m->nmaster) { +- h = (m->wh - my) / (MIN(n, m->nmaster) - i); +- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); +- if (my + HEIGHT(c) < m->wh) +- my += HEIGHT(c); ++ mw = m->ww - m->gappx; ++ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; ++ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); ++ if (my + HEIGHT(c) + m->gappx < m->wh) ++ my += HEIGHT(c) + m->gappx; + } else { +- h = (m->wh - ty) / (n - i); +- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); +- if (ty + HEIGHT(c) < m->wh) +- ty += HEIGHT(c); ++ h = (m->wh - ty) / (n - i) - m->gappx; ++ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); ++ if (ty + HEIGHT(c) + m->gappx < m->wh) ++ ty += HEIGHT(c) + m->gappx; + } + } diff --git a/patches/dwm-swaptags-6.2.diff b/patches/dwm-swaptags-6.2.diff new file mode 100644 index 0000000..e9d51c9 --- /dev/null +++ b/patches/dwm-swaptags-6.2.diff @@ -0,0 +1,68 @@ +From 9513cc776dc8114967988d4abc32fd7f37446ddb Mon Sep 17 00:00:00 2001 +From: fossy <fossy@dnmx.org> +Date: Sun, 28 Nov 2021 21:34:37 +0100 +Subject: [PATCH] Move function and it's prototype from config.def.h to dwm.c + +--- + config.def.h | 3 ++- + dwm.c | 23 +++++++++++++++++++++++ + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index a2ac963..f31a66d 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -50,7 +50,8 @@ static const Layout layouts[] = { + { 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} }, \ ++ { Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} }, + + /* helper for spawning shell commands in the pre dwm-5.0 fashion */ + #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +diff --git a/dwm.c b/dwm.c +index 5e4d494..d11addd 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); ++static void swaptags(const Arg *arg); + + /* variables */ + static const char broken[] = "broken"; +@@ -2127,6 +2128,28 @@ zoom(const Arg *arg) + pop(c); + } + ++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); ++} ++ + int + main(int argc, char *argv[]) + { +-- +2.34.1 + |