sites

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

commit 75881bd685af01b110b9689109337110972e40e5
parent 9ee4be35da9ce8c4dbdda35c240da1968eba13ad
Author: phi <crispyfrog@163.com>
Date:   Mon, 13 Feb 2017 13:39:08 +0800

[dwm] add rmaster patch

Diffstat:
Adwm.suckless.org/patches/dwm-rmaster-6.1.diff | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/rmaster.md | 21+++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-rmaster-6.1.diff b/dwm.suckless.org/patches/dwm-rmaster-6.1.diff @@ -0,0 +1,61 @@ +diff -urp dwm-6.1/dwm.c dwm-6.1-patched/dwm.c +--- dwm-6.1/dwm.c 2015-11-09 06:39:37.000000000 +0800 ++++ dwm-6.1-patched/dwm.c 2017-02-13 13:21:52.327153646 +0800 +@@ -130,6 +130,7 @@ struct Monitor { + Monitor *next; + Window barwin; + const Layout *lt[2]; ++ int rmaster; + }; + + typedef struct { +@@ -211,6 +212,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); +@@ -1674,17 +1676,21 @@ 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); + 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); + ty += HEIGHT(c); + } + } +@@ -1713,6 +1719,16 @@ togglefloating(const Arg *arg) + } + + 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) + { + unsigned int newtags; diff --git a/dwm.suckless.org/patches/rmaster.md b/dwm.suckless.org/patches/rmaster.md @@ -0,0 +1,21 @@ +# rmaster + +## Description + +Toggling between left-master (original behaviour) and right-master for the +current monitor. + +This patch only modifies the deafult layout 'tile', similar modifications can be +made to other custom layouts, like 'deck'. + +## Configuration + + /*config.h*/ + { MODKEY, XK_i, togglermaster, {0} }, + +## Download + +* [dwm-rmaster-6.1.diff](dwm-rmaster-6.1.diff) (1836b) (20170213) + +## Author +* phi <crispyfrog@163.com>