sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit c35a177bfa9cb58306352c3f6e83e286ea17d8fe
parent b59e324b0893f4bd38f655308aaa997ece323283
Author: jeromenerf <jerome.andrieux@gmail.com>
Date:   Sun, 16 Aug 2015 18:31:12 +0200

Add `centedermaster` layout patch

- nmaster area is displayed in the center of the screen
- stack is displayed below in an horizontally tiled layout, similar to
  `htile`
- page and patch attached

Diffstat:
Adwm.suckless.org/patches/centeredmaster.md | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/dwm-6.1-centeredmaster.diff | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/centeredmaster.md b/dwm.suckless.org/patches/centeredmaster.md @@ -0,0 +1,63 @@ +# centeredmaster + +`centeredmaster` layout patch makes the nmaster area centered +on screen, using `mfact * monitor width & height`, over an +horizontally tiled `stack` area, pretty much like +a "scratchpad". + +I find it useful on large screens (say 1920px wide), where +`monocle` or `htile` feels either too large or makes me type in +a corner of the screen. + +With `centeredmaster`, for instance, I can set my editor in the +center, while keeping an eye on what's happening in the windows +behind (logs, tests, ...). + + + +``` +With one client in master: ++------------------------------+ +|+--------++--------++--------+| +|| || || || +|| +------------------+ || +|| | | || +|| | | || +|| | M | || +|| | | || +|| +------------------+ || +|| || || || +|+--------++--------++--------+| ++------------------------------+ + +With two clients in master: ++------------------------------+ +|+--------++--------++--------+| +|| || || || +|| +--------++--------+ || +|| | || | || +|| | || | || +|| | M1 || M2 | || +|| | || | || +|| +--------++--------+ || +|| || || || +|+--------++--------++--------+| ++------------------------------+ +``` + +## Links + +* [dwm-6.1-centeredmaster.diff](dwm-6.1-centeredmaster.diff) - 4K, 2015/08/15 + + +[http://blog.jardinmagique.info](jerome) <jerome@gcu.info> + + + + + + + + + + diff --git a/dwm.suckless.org/patches/dwm-6.1-centeredmaster.diff b/dwm.suckless.org/patches/dwm-6.1-centeredmaster.diff @@ -0,0 +1,58 @@ +diff --git a/dwm.c b/dwm.c +index 783fcdb..ab179d8 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -215,6 +215,7 @@ static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *); + static void htile(Monitor *); ++static void centeredmaster(Monitor *); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); + static void toggletag(const Arg *arg); +@@ -1748,6 +1749,45 @@ htile(Monitor *m) { + } + + void ++centeredmaster(Monitor *m) { ++ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; ++ Client *c; ++ ++ // Count number of clients in the selected monitor ++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if(n == 0) ++ return; ++ ++ // initialize nmaster area ++ if(n > m->nmaster) { ++ // go mfact box in the center if more than nmaster clients ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ mh = m->nmaster ? m->wh * m->mfact : 0; ++ mx = mxo = (m->ww - mw) / 2; ++ my = myo = (m->wh - mh) / 2; ++ } else { ++ // Go fullscreen if all clients are in the master area ++ mh = m->wh; ++ mw = m->ww; ++ mx = mxo = 0; ++ my = mxo = 0; ++ } ++ ++ for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if(i < m->nmaster) { ++ // nmaster clients are stacked horizontally, in the center of the screen ++ w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), mh - (2*c->bw), False); ++ mx += WIDTH(c); ++ } else { ++ // Stack clients are stacked horizontally ++ w = (m->ww - tx) / (n - i); ++ resize(c, tx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), False); ++ tx += WIDTH(c); ++ } ++} ++ ++void + togglebar(const Arg *arg) { + selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; + updatebarpos(selmon);