added diff for personal first_centered_window patch
This commit is contained in:
parent
3a5cb824ff
commit
6878bedf98
95
patches/first_centered_window_personal.diff
Normal file
95
patches/first_centered_window_personal.diff
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
diff --git a/config.h b/config.h
|
||||||
|
index 9504079..8a8fba2 100644
|
||||||
|
--- a/config.h
|
||||||
|
+++ b/config.h
|
||||||
|
@@ -8,6 +8,7 @@ static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const int vertpad = 10; /* vertical padding of bar */
|
||||||
|
static const int sidepad = 20; /* horizontal padding of bar */
|
||||||
|
+static const float firstwindowoffset = 0.1; /* render first window 10% larger than mfact would for firstwindowcentered layout */
|
||||||
|
static const char *fonts[] = { "monospace:size=13",
|
||||||
|
"IPAGothic:size=13",
|
||||||
|
"symbola:size=13"};
|
||||||
|
@@ -85,13 +86,13 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
- { "[@]", spiral }, /* first entry is default */
|
||||||
|
+ { "1[\\]", centeredfirstwindow}, /* Master in middle, dwindle if more than masters*/
|
||||||
|
{ "[\\]", dwindle }, /* Default: Master on left, slaves on right */
|
||||||
|
- { "H[]", deck }, /* Master on left, slaves in monocle-like mode on right */
|
||||||
|
+ { "[@]", spiral }, /* first entry is default */
|
||||||
|
{ ">M>", centeredfloatingmaster }, /* Same but master floats */
|
||||||
|
+ { "H[]", deck }, /* Master on left, slaves in monocle-like mode on right */
|
||||||
|
{ "[]=", tile }, /* Default: Master on left, slaves on right */
|
||||||
|
{ "TTT", bstack }, /* Master on top, slaves on bottom */
|
||||||
|
- { "|M|", centeredmaster }, /* Master in middle, slaves on sides */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
{ "===", bstackhoriz },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 8081e23..a6774db 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -17,7 +17,6 @@
|
||||||
|
* client.
|
||||||
|
*
|
||||||
|
* Keys and tagging rules are organized as arrays and defined in config.h.
|
||||||
|
- *
|
||||||
|
* To understand everything else, start reading main().
|
||||||
|
*/
|
||||||
|
#include <errno.h>
|
||||||
|
@@ -252,6 +251,7 @@ static void bstack(Monitor *m);
|
||||||
|
static void bstackhoriz(Monitor *m);
|
||||||
|
static void centeredmaster(Monitor *m);
|
||||||
|
static void centeredfloatingmaster(Monitor *m);
|
||||||
|
+static void centeredfirstwindow(Monitor *m);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
static Client *prevzoom = NULL;
|
||||||
|
@@ -2492,6 +2492,45 @@ centeredmaster(Monitor *m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+centeredfirstwindow(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx;
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ /* print nmaster in layout */
|
||||||
|
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d[\\]", m->nmaster);
|
||||||
|
+
|
||||||
|
+ /* 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 (m->ww > m->wh) {
|
||||||
|
+ mw = m->nmaster ? m->ww * MIN(1.0, (m->mfact + firstwindowoffset)) : 0;
|
||||||
|
+ mh = m->nmaster ? m->wh : 0;
|
||||||
|
+ } else {
|
||||||
|
+ mh = m->nmaster ? m->wh * MIN(1.0, (m->mfact + firstwindowoffset)) : 0;
|
||||||
|
+ mw = m->nmaster ? m->ww : 0;
|
||||||
|
+ }
|
||||||
|
+ mx = mxo = (m->ww - mw) / 2;
|
||||||
|
+ my = myo = (m->wh - mh) / 2;
|
||||||
|
+
|
||||||
|
+ if ( n > m->nmaster){
|
||||||
|
+ fibonacci(m, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ 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), 0);
|
||||||
|
+ mx += WIDTH(c);
|
||||||
|
+ } }
|
||||||
|
void
|
||||||
|
centeredfloatingmaster(Monitor *m)
|
||||||
|
{
|
Loading…
Reference in New Issue
Block a user