[wiki] [sites] Port dwm-rmaster to version 6.2 || pskry

From: <git_AT_suckless.org>
Date: Mon, 16 Nov 2020 20:15:41 +0100

commit b3c2ee730adf112c33d91500598568640f3c39fb
Author: pskry <peter_AT_skrypalle.dk>
Date: Mon Nov 16 20:13:26 2020 +0100

    Port dwm-rmaster to version 6.2
    
    Port rmaster patch of dwm to dwm version 6.2.

diff --git a/dwm.suckless.org/patches/rmaster/dwm-rmaster-6.2.diff b/dwm.suckless.org/patches/rmaster/dwm-rmaster-6.2.diff
new file mode 100644
index 00000000..1da89381
--- /dev/null
+++ b/dwm.suckless.org/patches/rmaster/dwm-rmaster-6.2.diff
_AT_@ -0,0 +1,114 @@
+From de2bfe560a8085630ffe976fd5972ee1e8d03916 Mon Sep 17 00:00:00 2001
+From: pskry <peter_AT_skrypalle.dk>
+Date: Mon, 16 Nov 2020 17:47:05 +0100
+Subject: [PATCH] Enable swapping master- and stack-area
+
+Enables swapping the master- and stack area such that the master-client
+appears on the right and the stack-clients appear on the left.
+
+A variable and a toggle-function are introduced to achieve this
+behaviour which are set in the config.h:
+
+* The rmaster-variable can be set to 1 to make the right area the
+default master-area
+* The togglemaster-function can be used to swap the master- and
+stack-areas dynamically.
+---
+ config.def.h | 2 ++
+ dwm.c | 23 ++++++++++++++++++++---
+ 2 files changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..1d00282 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -3,6 +3,7 @@
+ /* appearance */
+ static const unsigned int borderpx = 1; /* border pixel of windows */
+ static const unsigned int snap = 32; /* snap pixel */
++static const int rmaster = 1; /* 1 means master-area is initially on the right */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
+ static const char *fonts[] = { "monospace:size=10" };
+_AT_@ -78,6 +79,7 @@ static Key keys[] = {
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
++ { MODKEY, XK_r, togglermaster, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+ { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
+ { MODKEY, XK_comma, focusmon, {.i = -1 } },
+diff --git a/dwm.c b/dwm.c
+index 664c527..cc9a7f6 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -122,6 +122,7 @@ struct Monitor {
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
++ int rmaster;
+ int showbar;
+ int topbar;
+ Client *clients;
+_AT_@ -212,6 +213,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglermaster(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+_AT_@ -637,6 +639,7 @@ createmon(void)
+ m->tagset[0] = m->tagset[1] = 1;
+ m->mfact = mfact;
+ m->nmaster = nmaster;
++ m->rmaster = rmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
+ m->lt[0] = &layouts[0];
+_AT_@ -1682,18 +1685,22 @@ tile(Monitor *m)
+ return;
+
+ if (n > m->nmaster)
+- mw = m->nmaster ? m->ww * m->mfact : 0;
++ mw = m->nmaster
++ ? m->ww * (m->rmaster ? 1.0 - m->mfact : 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);
++ resize(c, m->rmaster ? m->wx + m->ww - mw : m->wx,
++ m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+ if (my + HEIGHT(c) < m->wh)
+ my += HEIGHT(c);
+ } 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);
++ resize(c, m->rmaster ? m->wx : 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);
+ }
+_AT_@ -1722,6 +1729,16 @@ togglefloating(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++togglermaster(const Arg *arg)
++{
++ selmon->rmaster = !selmon->rmaster;
++ /* now mfact represents the left factor */
++ selmon->mfact = 1.0 - selmon->mfact;
++ if (selmon->lt[selmon->sellt]->arrange)
++ arrange(selmon);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+--
+2.29.2
+
diff --git a/dwm.suckless.org/patches/rmaster/index.md b/dwm.suckless.org/patches/rmaster/index.md
index da4fde5e..c7490874 100644
--- a/dwm.suckless.org/patches/rmaster/index.md
+++ b/dwm.suckless.org/patches/rmaster/index.md
_AT_@ -19,8 +19,10 @@ stack-areas dynamically.
 Download
 --------
 * [dwm-rmaster-6.1.diff](dwm-rmaster-6.1.diff) (20190418)
+* [dwm-rmaster-6.2.diff](dwm-rmaster-6.2.diff) (20201116)
 
 Author
 ------
 * phi <crispyfrog_AT_163.com>
 * Aleksandrs Stier (Contributor)
+* Peter Skrypalle (6.2 port)
Received on Mon Nov 16 2020 - 20:15:41 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 16 2020 - 20:24:42 CET