Update suckless config
parent
ed0c3e9b5f
commit
24c8c90aea
|
@ -1,7 +1,7 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static const unsigned int gappx = 5; /* gaps between windows */
|
static const unsigned int gappx = 5; /* gaps between windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
@ -9,13 +9,13 @@ static const int topbar = 0; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = { "Iosevka:size=10" };
|
static const char *fonts[] = { "Iosevka:size=10" };
|
||||||
static const char dmenufont[] = "Iosevka:size=10";
|
static const char dmenufont[] = "Iosevka:size=10";
|
||||||
static const char col_gray1[] = "#000000";
|
static const char col_gray1[] = "#000000";
|
||||||
static const char col_gray2[] = "#444444";
|
static const char col_gray2[] = "#222222";
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static const char col_gray3[] = "#444444";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static const char col_gray4[] = "#eeeeee";
|
||||||
static const char *colors[][3] = {
|
static const char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { col_gray2, col_gray1, col_gray1 },
|
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||||
[SchemeSel] = { col_gray3, col_gray1, col_gray2 },
|
[SchemeSel] = { col_gray4, col_gray1, col_gray3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
|
@ -79,7 +79,7 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
|
{ MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
|
||||||
{ MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
|
{ MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[4]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
|
Binary file not shown.
|
@ -2175,13 +2175,19 @@ centeredmaster(Monitor *m)
|
||||||
|
|
||||||
/* count number of clients in the selected monitor */
|
/* count number of clients in the selected monitor */
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
if(n == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize areas */
|
/* initialize areas */
|
||||||
mw = m->ww;
|
mw = m->ww;
|
||||||
mx = 0;
|
mx = 0;
|
||||||
my = 0;
|
my = m->gappx;
|
||||||
tw = mw;
|
tw = mw;
|
||||||
|
|
||||||
if (n > m->nmaster) {
|
if (n > m->nmaster) {
|
||||||
|
@ -2196,28 +2202,31 @@ centeredmaster(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oty = 0;
|
oty = m->gappx;
|
||||||
ety = 0;
|
ety = m->gappx;
|
||||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
/* nmaster clients are stacked vertically, in the center
|
/* nmaster clients are stacked vertically, in the center
|
||||||
* of the screen */
|
* of the screen */
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||||
resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw),
|
if(m->nmaster >= n)
|
||||||
h - (2*c->bw), 0);
|
resize(c, m->wx + mx + m->gappx, m->wy + my, mw - 2*(c->bw + m->gappx),
|
||||||
my += HEIGHT(c);
|
h - (2*c->bw) - m->gappx, 0);
|
||||||
|
else if(m->nmaster + 1 < n)
|
||||||
|
resize(c, m->wx + mx + m->gappx/2, m->wy + my, mw - 2*c->bw - m->gappx, h - 2*c->bw - m->gappx, 0);
|
||||||
|
else
|
||||||
|
resize(c, m->wx + mx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
|
my += HEIGHT(c) + m->gappx;
|
||||||
} else {
|
} else {
|
||||||
/* stack clients are stacked vertically */
|
/* stack clients are stacked vertically */
|
||||||
if ((i - m->nmaster) % 2 ) {
|
if ((i - m->nmaster) % 2) {
|
||||||
h = (m->wh - ety) / ( (1 + n - i) / 2);
|
h = (m->wh - ety) / ( (1 + n - i) / 2);
|
||||||
resize(c, m->wx, m->wy + ety, tw - (2*c->bw),
|
resize(c, m->wx + m->gappx, m->wy + ety, tw - (2*c->bw) - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
h - (2*c->bw), 0);
|
ety += HEIGHT(c) + m->gappx;
|
||||||
ety += HEIGHT(c);
|
|
||||||
} else {
|
} else {
|
||||||
h = (m->wh - oty) / ((1 + n - i) / 2);
|
h = (m->wh - oty) / ((1 + n - i) / 2);
|
||||||
resize(c, m->wx + mx + mw, m->wy + oty,
|
resize(c, m->wx + mx + mw + m->gappx/2, m->wy + oty, tw - (2*c->bw) - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
tw - (2*c->bw), h - (2*c->bw), 0);
|
oty += HEIGHT(c) + m->gappx;
|
||||||
oty += HEIGHT(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2232,6 +2241,11 @@ centeredfloatingmaster(Monitor *m)
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
if(n == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize nmaster area */
|
/* initialize nmaster area */
|
||||||
if (n > m->nmaster) {
|
if (n > m->nmaster) {
|
||||||
|
@ -2243,29 +2257,31 @@ centeredfloatingmaster(Monitor *m)
|
||||||
mh = m->nmaster ? m->wh * m->mfact : 0;
|
mh = m->nmaster ? m->wh * m->mfact : 0;
|
||||||
mw = m->nmaster ? m->ww * 0.9 : 0;
|
mw = m->nmaster ? m->ww * 0.9 : 0;
|
||||||
}
|
}
|
||||||
mx = mxo = (m->ww - mw) / 2;
|
mx = mxo = (m->ww - mw + m->gappx) / 2;
|
||||||
my = myo = (m->wh - mh) / 2;
|
my = myo = (m->wh - mh) / 2;
|
||||||
} else {
|
} else {
|
||||||
/* go fullscreen if all clients are in the master area */
|
/* go fullscreen if all clients are in the master area */
|
||||||
mh = m->wh;
|
mh = m->wh;
|
||||||
mw = m->ww;
|
mw = m->ww;
|
||||||
mx = mxo = 0;
|
mx = m->gappx;
|
||||||
|
mxo = 0;
|
||||||
my = myo = 0;
|
my = myo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
tx = m->gappx;
|
||||||
|
for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
/* nmaster clients are stacked horizontally, in the center
|
/* nmaster clients are stacked horizontally, in the center
|
||||||
* of the screen */
|
* of the screen */
|
||||||
w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i);
|
w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i) + m->gappx;
|
||||||
resize(c, m->wx + mx, m->wy + my, w - (2*c->bw),
|
resize(c, m->wx + mx, m->wy + my + m->gappx, w - 2*(c->bw + m->gappx),
|
||||||
mh - (2*c->bw), 0);
|
mh - 2*(c->bw + m->gappx), 0);
|
||||||
mx += WIDTH(c);
|
mx += WIDTH(c) + m->gappx;
|
||||||
} else {
|
} else {
|
||||||
/* stack clients are stacked horizontally */
|
/* stack clients are stacked horizontally */
|
||||||
w = (m->ww - tx) / (n - i);
|
w = (m->ww - tx) / (n - i) + m->gappx;
|
||||||
resize(c, m->wx + tx, m->wy, w - (2*c->bw),
|
resize(c, m->wx + tx, m->wy + m->gappx, w - 2*(c->bw + m->gappx),
|
||||||
m->wh - (2*c->bw), 0);
|
m->wh - 2*(c->bw + m->gappx), 0);
|
||||||
tx += WIDTH(c);
|
tx += WIDTH(c) + m->gappx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,157 @@
|
||||||
|
diff -up a/config.h b/config.h
|
||||||
|
--- a/config.h 2019-07-24 08:59:14.429282151 +0200
|
||||||
|
+++ b/config.h 2019-07-24 09:30:18.841019314 +0200
|
||||||
|
@@ -42,6 +42,8 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { "|M|", centeredmaster },
|
||||||
|
+ { ">M>", centeredfloatingmaster },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
@@ -77,6 +79,8 @@ 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_u, setlayout, {.v = &layouts[3]} },
|
||||||
|
+ { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[4]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
diff -up a/dwm.c b/dwm.c
|
||||||
|
--- a/dwm.c 2019-07-24 08:59:14.432615503 +0200
|
||||||
|
+++ b/dwm.c 2019-07-24 09:24:16.192110897 +0200
|
||||||
|
@@ -235,6 +235,8 @@ static int xerror(Display *dpy, XErrorEv
|
||||||
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
|
static void zoom(const Arg *arg);
|
||||||
|
+static void centeredmaster(Monitor *m);
|
||||||
|
+static void centeredfloatingmaster(Monitor *m);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
@@ -2176,3 +2178,122 @@ main(int argc, char *argv[])
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+centeredmaster(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ unsigned int i, n, h, mw, mx, my, oty, ety, tw;
|
||||||
|
+ 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;
|
||||||
|
+ if(n == 1){
|
||||||
|
+ c = nexttiled(m->clients);
|
||||||
|
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* initialize areas */
|
||||||
|
+ mw = m->ww;
|
||||||
|
+ mx = 0;
|
||||||
|
+ my = m->gappx;
|
||||||
|
+ tw = mw;
|
||||||
|
+
|
||||||
|
+ if (n > m->nmaster) {
|
||||||
|
+ /* go mfact box in the center if more than nmaster clients */
|
||||||
|
+ mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ tw = m->ww - mw;
|
||||||
|
+
|
||||||
|
+ if (n - m->nmaster > 1) {
|
||||||
|
+ /* only one client */
|
||||||
|
+ mx = (m->ww - mw) / 2;
|
||||||
|
+ tw = (m->ww - mw) / 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ oty = m->gappx;
|
||||||
|
+ ety = m->gappx;
|
||||||
|
+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ if (i < m->nmaster) {
|
||||||
|
+ /* nmaster clients are stacked vertically, in the center
|
||||||
|
+ * of the screen */
|
||||||
|
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||||
|
+ if(m->nmaster >= n)
|
||||||
|
+ resize(c, m->wx + mx + m->gappx, m->wy + my, mw - 2*(c->bw + m->gappx),
|
||||||
|
+ h - (2*c->bw) - m->gappx, 0);
|
||||||
|
+ else if(m->nmaster + 1 < n)
|
||||||
|
+ resize(c, m->wx + mx + m->gappx/2, m->wy + my, mw - 2*c->bw - m->gappx, h - 2*c->bw - m->gappx, 0);
|
||||||
|
+ else
|
||||||
|
+ resize(c, m->wx + mx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
|
+ my += HEIGHT(c) + m->gappx;
|
||||||
|
+ } else {
|
||||||
|
+ /* stack clients are stacked vertically */
|
||||||
|
+ if ((i - m->nmaster) % 2) {
|
||||||
|
+ h = (m->wh - ety) / ( (1 + n - i) / 2);
|
||||||
|
+ resize(c, m->wx + m->gappx, m->wy + ety, tw - (2*c->bw) - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
|
+ ety += HEIGHT(c) + m->gappx;
|
||||||
|
+ } else {
|
||||||
|
+ h = (m->wh - oty) / ((1 + n - i) / 2);
|
||||||
|
+ resize(c, m->wx + mx + mw + m->gappx/2, m->wy + oty, tw - (2*c->bw) - m->gappx*3/2, h - 2*c->bw - m->gappx, 0);
|
||||||
|
+ oty += HEIGHT(c) + m->gappx;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+centeredfloatingmaster(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;
|
||||||
|
+ if(n == 1){
|
||||||
|
+ c = nexttiled(m->clients);
|
||||||
|
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* initialize nmaster area */
|
||||||
|
+ if (n > m->nmaster) {
|
||||||
|
+ /* go mfact box in the center if more than nmaster clients */
|
||||||
|
+ if (m->ww > m->wh) {
|
||||||
|
+ mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ mh = m->nmaster ? m->wh * 0.9 : 0;
|
||||||
|
+ } else {
|
||||||
|
+ mh = m->nmaster ? m->wh * m->mfact : 0;
|
||||||
|
+ mw = m->nmaster ? m->ww * 0.9 : 0;
|
||||||
|
+ }
|
||||||
|
+ mx = mxo = (m->ww - mw + m->gappx) / 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 = m->gappx;
|
||||||
|
+ mxo = 0;
|
||||||
|
+ my = myo = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ tx = m->gappx;
|
||||||
|
+ for(i = 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) + m->gappx;
|
||||||
|
+ resize(c, m->wx + mx, m->wy + my + m->gappx, w - 2*(c->bw + m->gappx),
|
||||||
|
+ mh - 2*(c->bw + m->gappx), 0);
|
||||||
|
+ mx += WIDTH(c) + m->gappx;
|
||||||
|
+ } else {
|
||||||
|
+ /* stack clients are stacked horizontally */
|
||||||
|
+ w = (m->ww - tx) / (n - i) + m->gappx;
|
||||||
|
+ resize(c, m->wx + tx, m->wy + m->gappx, w - 2*(c->bw + m->gappx),
|
||||||
|
+ m->wh - 2*(c->bw + m->gappx), 0);
|
||||||
|
+ tx += WIDTH(c) + m->gappx;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
|
BIN
.suckless/st/st
BIN
.suckless/st/st
Binary file not shown.
Binary file not shown.
BIN
.suckless/st/x.o
BIN
.suckless/st/x.o
Binary file not shown.
Loading…
Reference in New Issue