From f6f49263ed27aa8a289ca636d5e2e79eb17f731f Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 25 Aug 2022 16:27:36 +0200 Subject: up --- applied/dwm-stairs-fullgaps-20220430-8b48e30.diff | 98 +++++++++++++++++++++++ dwm-stairs-fullgaps-20220430-8b48e30.diff | 98 ----------------------- dwm-zoomswap-6.2.diff | 95 ++++++++++++++++++++++ dwm.c | 44 +++++++++- 4 files changed, 233 insertions(+), 102 deletions(-) create mode 100644 applied/dwm-stairs-fullgaps-20220430-8b48e30.diff delete mode 100644 dwm-stairs-fullgaps-20220430-8b48e30.diff create mode 100644 dwm-zoomswap-6.2.diff diff --git a/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff b/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff new file mode 100644 index 0000000..53e7966 --- /dev/null +++ b/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff @@ -0,0 +1,98 @@ +From 2004db267a9478918699961ab2f3579c2c8113fb Mon Sep 17 00:00:00 2001 +From: Ehsan Ghorbannezhad +Date: Sat, 30 Apr 2022 02:48:58 +0430 +Subject: [PATCH] add the stairs layout with fullgaps support + +--- + config.def.h | 5 +++++ + dwm.c | 38 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 43 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 5b0d4de..c0f24f4 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,9 @@ 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 */ ++static const unsigned int stairpx = 20; /* depth of the stairs layout */ ++static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */ ++static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +@@ -43,6 +46,7 @@ static const Layout layouts[] = { + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "[S]", stairs }, + }; + + /* key definitions */ +@@ -78,6 +82,7 @@ static Key keys[] = { + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_s, setlayout, {.v = &layouts[3]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, +diff --git a/dwm.c b/dwm.c +index 5b7348c..2c5380f 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -209,6 +209,7 @@ static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); ++static void stairs(Monitor *m); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *); +@@ -1672,6 +1673,43 @@ spawn(const Arg *arg) + } + } + ++void ++stairs(Monitor *m) ++{ ++ unsigned int i, n, h, mw, my; ++ unsigned int ox, oy, ow, oh; /* stair offset values */ ++ Client *c; ++ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ if (n > m->nmaster) ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ else ++ mw = m->ww - m->gappx; ++ ++ for (i = 0, my = 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 { ++ oy = i - m->nmaster; ++ ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0); ++ ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1; ++ oh = stairsamesize ? ow : i - m->nmaster; ++ resize(c, ++ m->wx + mw + (ox * stairpx) + m->gappx, ++ m->wy + (oy * stairpx) + m->gappx, ++ m->ww - mw - (2 * c->bw) - (ow * stairpx) - (2 * m->gappx), ++ m->wh - (2 * c->bw) - (oh * stairpx) - (2 * m->gappx), ++ 0); ++ } ++ } ++} ++ + void + tag(const Arg *arg) + { +-- +2.36.0 diff --git a/dwm-stairs-fullgaps-20220430-8b48e30.diff b/dwm-stairs-fullgaps-20220430-8b48e30.diff deleted file mode 100644 index 53e7966..0000000 --- a/dwm-stairs-fullgaps-20220430-8b48e30.diff +++ /dev/null @@ -1,98 +0,0 @@ -From 2004db267a9478918699961ab2f3579c2c8113fb Mon Sep 17 00:00:00 2001 -From: Ehsan Ghorbannezhad -Date: Sat, 30 Apr 2022 02:48:58 +0430 -Subject: [PATCH] add the stairs layout with fullgaps support - ---- - config.def.h | 5 +++++ - dwm.c | 38 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+) - -diff --git a/config.def.h b/config.def.h -index 5b0d4de..c0f24f4 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -6,6 +6,9 @@ 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 */ -+static const unsigned int stairpx = 20; /* depth of the stairs layout */ -+static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */ -+static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ - static const char *fonts[] = { "monospace:size=10" }; - static const char dmenufont[] = "monospace:size=10"; - static const char col_gray1[] = "#222222"; -@@ -43,6 +46,7 @@ static const Layout layouts[] = { - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -+ { "[S]", stairs }, - }; - - /* key definitions */ -@@ -78,6 +82,7 @@ static Key keys[] = { - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, -+ { MODKEY, XK_s, setlayout, {.v = &layouts[3]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, -diff --git a/dwm.c b/dwm.c -index 5b7348c..2c5380f 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -209,6 +209,7 @@ static void seturgent(Client *c, int urg); - static void showhide(Client *c); - static void sigchld(int unused); - static void spawn(const Arg *arg); -+static void stairs(Monitor *m); - static void tag(const Arg *arg); - static void tagmon(const Arg *arg); - static void tile(Monitor *); -@@ -1672,6 +1673,43 @@ spawn(const Arg *arg) - } - } - -+void -+stairs(Monitor *m) -+{ -+ unsigned int i, n, h, mw, my; -+ unsigned int ox, oy, ow, oh; /* stair offset values */ -+ Client *c; -+ -+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ if (n == 0) -+ return; -+ -+ if (n > m->nmaster) -+ mw = m->nmaster ? m->ww * m->mfact : 0; -+ else -+ mw = m->ww - m->gappx; -+ -+ for (i = 0, my = 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 { -+ oy = i - m->nmaster; -+ ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0); -+ ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1; -+ oh = stairsamesize ? ow : i - m->nmaster; -+ resize(c, -+ m->wx + mw + (ox * stairpx) + m->gappx, -+ m->wy + (oy * stairpx) + m->gappx, -+ m->ww - mw - (2 * c->bw) - (ow * stairpx) - (2 * m->gappx), -+ m->wh - (2 * c->bw) - (oh * stairpx) - (2 * m->gappx), -+ 0); -+ } -+ } -+} -+ - void - tag(const Arg *arg) - { --- -2.36.0 diff --git a/dwm-zoomswap-6.2.diff b/dwm-zoomswap-6.2.diff new file mode 100644 index 0000000..3c658e6 --- /dev/null +++ b/dwm-zoomswap-6.2.diff @@ -0,0 +1,95 @@ +From 3867ef5a68e15a4faff377ddbc8371853de4a800 Mon Sep 17 00:00:00 2001 +From: aleks +Date: Sat, 19 Oct 2019 00:56:21 +0200 +Subject: [PATCH] Put master to exact position of zoomed client + +The default behaviour when zooming a client is to put the previous +master on top of the client-stack. This patch puts the master to the +exact position of the zoomed client in the stack. +--- + dwm.c | 44 ++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 40 insertions(+), 4 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..1719b36 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -165,6 +165,7 @@ static void drawbar(Monitor *m); + static void drawbars(void); + static void enternotify(XEvent *e); + static void expose(XEvent *e); ++static Client *findbefore(Client *c); + static void focus(Client *c); + static void focusin(XEvent *e); + static void focusmon(const Arg *arg); +@@ -235,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); + + /* variables */ ++static Client *prevzoom = NULL; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -780,6 +782,16 @@ expose(XEvent *e) + drawbar(m); + } + ++Client * ++findbefore(Client *c) ++{ ++ Client *tmp; ++ if (c == selmon->clients) ++ return NULL; ++ for (tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next); ++ return tmp; ++} ++ + void + focus(Client *c) + { +@@ -2114,14 +2126,38 @@ void + zoom(const Arg *arg) + { + Client *c = selmon->sel; ++ Client *at = NULL, *cold, *cprevious = NULL; + + if (!selmon->lt[selmon->sellt]->arrange + || (selmon->sel && selmon->sel->isfloating)) + return; +- if (c == nexttiled(selmon->clients)) +- if (!c || !(c = nexttiled(c->next))) +- return; +- pop(c); ++ if (c == nexttiled(selmon->clients)) { ++ at = findbefore(prevzoom); ++ if (at) ++ cprevious = nexttiled(at->next); ++ if (!cprevious || cprevious != prevzoom) { ++ prevzoom = NULL; ++ if (!c || !(c = nexttiled(c->next))) ++ return; ++ } else ++ c = cprevious; ++ } ++ cold = nexttiled(selmon->clients); ++ if (c != cold && !at) ++ at = findbefore(c); ++ detach(c); ++ attach(c); ++ /* swap windows instead of pushing the previous one down */ ++ if (c != cold && at) { ++ prevzoom = cold; ++ if (cold && at != cold) { ++ detach(cold); ++ cold->next = at->next; ++ at->next = cold; ++ } ++ } ++ focus(c); ++ arrange(c->mon); + } + + int +-- +2.23.0 + diff --git a/dwm.c b/dwm.c index 5867298..876e35f 100644 --- a/dwm.c +++ b/dwm.c @@ -174,6 +174,7 @@ static void drawbar(Monitor *m); static void drawbars(void); static void drawtaggrid(Monitor *m, int *x_pos, unsigned int occ); static void expose(XEvent *e); +static Client *findbefore(Client *c); static void focus(Client *c); static void focusin(XEvent *e); static void focusmon(const Arg *arg); @@ -256,6 +257,7 @@ static void bstackhoriz(Monitor *m); static void stairs(Monitor *m); /* variables */ +static Client *prevzoom = NULL; static const char broken[] = "broken"; static char stext[256]; static int screen; @@ -921,6 +923,16 @@ expose(XEvent *e) drawbar(m); } +Client * +findbefore(Client *c) +{ + Client *tmp; + if (c == selmon->clients) + return NULL; + for (tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next); + return tmp; +} + void focus(Client *c) { @@ -2488,14 +2500,38 @@ void zoom(const Arg *arg) { Client *c = selmon->sel; + Client *at = NULL, *cold, *cprevious = NULL; if (!selmon->lt[selmon->sellt]->arrange || (selmon->sel && selmon->sel->isfloating)) return; - if (c == nexttiled(selmon->clients)) - if (!c || !(c = nexttiled(c->next))) - return; - pop(c); + if (c == nexttiled(selmon->clients)) { + at = findbefore(prevzoom); + if (at) + cprevious = nexttiled(at->next); + if (!cprevious || cprevious != prevzoom) { + prevzoom = NULL; + if (!c || !(c = nexttiled(c->next))) + return; + } else + c = cprevious; + } + cold = nexttiled(selmon->clients); + if (c != cold && !at) + at = findbefore(c); + detach(c); + attach(c); + /* swap windows instead of pushing the previous one down */ + if (c != cold && at) { + prevzoom = cold; + if (cold && at != cold) { + detach(cold); + cold->next = at->next; + at->next = cold; + } + } + focus(c); + arrange(c->mon); } int -- cgit v1.2.3