diff options
-rw-r--r-- | config.def.h | 4 | ||||
-rw-r--r-- | config.h | 6 | ||||
-rw-r--r-- | dwm.c | 85 | ||||
-rw-r--r-- | patches/uselessgap.diff | 14 |
4 files changed, 80 insertions, 29 deletions
diff --git a/config.def.h b/config.def.h index 9f840d6..9560f9f 100644 --- a/config.def.h +++ b/config.def.h @@ -50,6 +50,8 @@ static const Layout layouts[] = { { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "TTT", bstack }, + { "===", bstackhoriz }, }; /* key definitions */ @@ -86,6 +88,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, XK_o, setlayout, {.v = &layouts[4]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, @@ -27,7 +27,7 @@ static const char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8" }; +static const char *tags[] = { "1", "2", "3", "4", "5", "6" }; static const Rule rules[] = { /* xprop(1): @@ -57,6 +57,7 @@ static const Layout layouts[] = { { "t", tile }, /* first entry is default */ { "FL", NULL }, /* no layout function means floating behavior */ { "m", monocle }, + { "=", bstackhoriz }, }; /* key definitions */ @@ -80,7 +81,7 @@ static const char *screenshooter[] = { "screenshot.sh", NULL }; static const char *volup[] = { "volup.sh", NULL }; static const char *voldown[] = { "voldown.sh", NULL }; //static const char *volmute[] = { "volmute.sh", NULL }; (replaced with *next[] for different keyboards) -static const char *firefox[] = { "firefox", "--new-window", NULL }; +static const char *firefox[] = { "librewolf-bin", NULL }; static const char *slock[] = { "slock", NULL }; static const char *playpause[] = { "playerctl", "play-pause", NULL }; static const char *next[] = { "f9.sh", NULL }; @@ -106,6 +107,7 @@ 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_o, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, @@ -249,6 +249,8 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void bstack(Monitor *m); +static void bstackhoriz(Monitor *m); /* variables */ static const char broken[] = "broken"; @@ -437,7 +439,7 @@ attachstack(Client *c) void buttonpress(XEvent *e) { - unsigned int i, x, click, occ = 0; + unsigned int i, x, click; Arg arg = {0}; Client *c; Monitor *m; @@ -452,14 +454,9 @@ buttonpress(XEvent *e) } if (ev->window == selmon->barwin) { i = x = 0; - for (c = m->clients; c; c = c->next) - occ |= c->tags == 255 ? 0 : c->tags; - do { - /* do not reserve space for vacant tags */ - if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) - continue; + do x += TEXTW(tags[i]); - } while (ev->x >= x && ++i < LENGTH(tags)); + while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; @@ -761,19 +758,19 @@ drawbar(Monitor *m) } for (c = m->clients; c; c = c->next) { - occ |= c->tags == 255 ? 0 : c->tags; + occ |= c->tags; if (c->isurgent) urg |= c->tags; } x = 0; for (i = 0; i < LENGTH(tags); i++) { - /* do not draw vacant tags */ - if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) - continue; - w = TEXTW(tags[i]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); + if (occ & 1 << i) + drw_rect(drw, x + boxs, boxs, boxw, boxw, + m == selmon && selmon->sel && selmon->sel->tags & 1 << i, + urg & 1 << i); x += w; } w = blw = TEXTW(m->ltsymbol); @@ -2369,3 +2366,65 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } + +static void +bstack(Monitor *m) { + int w, h, mh, mx, tx, ty, tw; + unsigned int i, n; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + if (n > m->nmaster) { + mh = m->nmaster ? m->mfact * m->wh : 0; + tw = m->ww / (n - m->nmaster); + ty = m->wy + mh; + } else { + mh = m->wh; + tw = m->ww; + ty = m->wy; + } + for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + w = (m->ww - mx) / (MIN(n, m->nmaster) - i); + resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); + mx += WIDTH(c); + } else { + h = m->wh - mh; + resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0); + if (tw != m->ww) + tx += WIDTH(c); + } + } +} + +static void +bstackhoriz(Monitor *m) { + int w, mh, mx, tx, ty, th; + unsigned int i, n; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + if (n > m->nmaster) { + mh = m->nmaster ? m->mfact * m->wh : 0; + th = (m->wh - mh) / (n - m->nmaster); + ty = m->wy + mh; + } else { + th = mh = m->wh; + ty = m->wy; + } + for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + w = (m->ww - mx) / (MIN(n, m->nmaster) - i); + resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); + mx += WIDTH(c); + } else { + resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); + if (th != m->wh) + ty += HEIGHT(c); + } + } +} diff --git a/patches/uselessgap.diff b/patches/uselessgap.diff index d9cacbe..1bf2ea0 100644 --- a/patches/uselessgap.diff +++ b/patches/uselessgap.diff @@ -4,22 +4,8 @@ Date: Wed, 3 Jul 2019 21:33:45 -0700 Subject: [PATCH] Port the uselessgap patch to 6.2 --- - config.def.h | 1 + dwm.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..b11471d 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -2,6 +2,7 @@ - - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ -+static const unsigned int gappx = 6; /* gaps between windows */ - static const unsigned int snap = 32; /* snap pixel */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ diff --git a/dwm.c b/dwm.c index 4465af1..4545e05 100644 --- a/dwm.c |