dwm-old

my heavily-patched and customized dwm build
git clone git://git.kocotian.pl/dwm.git
Log | Files | Refs | README | LICENSE

commit 76779d430233520e60ad6f711b2ff9c26153ab2e
parent 754207cb97da02cd0adc9a4a8ef3f4b16e87c2b7
Author: kocotian <kocotian@kocotian.pl>
Date:   Fri, 22 Jan 2021 14:41:17 +0100

gaps (only tile)

Diffstat:
Mconfig.def.h | 16++++++++++------
Mdwm.c | 44++++++++++++++++++++++++++++++++++++++++----
2 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -12,6 +12,8 @@ static const int topbar = 1; /* 0 means bottom bar */ static const char statussep = ';'; /* separator between status bars */ static const int barheight = 25; /* height of a bar; 0 equals autocalculation */ static const int attachdirection = 0; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */ +static const int ogappx = 30; +static const int igappx = 3; static const char *fonts[] = { "monospace:size=8", "JoyPixels:pixelsize=10:antialias=true:autohint=true" }; static const char dmenufont[] = "monospace:size=8"; static const char col_gray1[] = "#222222"; @@ -196,7 +198,7 @@ static Key keys[] = { { MODKEY, XK_bracketright, spawn, SHCMD("mpc seek +10") }, { MODKEY|ShiftMask, XK_bracketright, spawn, SHCMD("mpc seek +60") }, - { MODKEY, XK_a, spawn, SHCMD("st -e lf") }, + { MODKEY, XK_a, gaptog, {0} }, { MODKEY|ShiftMask, XK_a, spawn, SHCMD("st -e htop") }, { MODKEY, XK_d, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_d, spawn, SHCMD("dmenize") }, @@ -224,13 +226,15 @@ static Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_z, setlayout, {0} }, - { MODKEY|ShiftMask, XK_z, resetlayout, {0} }, - { MODKEY, XK_x, setattach, {0} }, - { MODKEY|ShiftMask, XK_x, setattach, {.i = -1} }, + { MODKEY, XK_z, setattach, {0} }, + { MODKEY|ShiftMask, XK_z, setattach, {.i = -1} }, + { MODKEY, XK_x, spawn, SHCMD("st -e calcurse") }, + { MODKEY, XK_c, setigappx, {.i = +3} }, + { MODKEY, XK_v, setigappx, {.i = -3} }, + { MODKEY|ShiftMask, XK_c, setogappx, {.i = +3} }, + { MODKEY|ShiftMask, XK_v, setogappx, {.i = -3} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY|ShiftMask, XK_b, spawn, SHCMD("setbg") }, - { MODKEY, XK_c, spawn, SHCMD("st -e calcurse") }, { MODKEY, XK_n, spawn, SHCMD("st -e newsboat; pkill -RTMIN+6 dwmblocks") }, { MODKEY|ShiftMask, XK_n, spawn, SHCMD("st -e nvim -c VimwikiIndex") }, { MODKEY, XK_m, spawn, SHCMD("st -e ncmpcpp") }, diff --git a/dwm.c b/dwm.c @@ -144,6 +144,7 @@ struct Monitor { int eby; /* extra bar geometry */ int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ + unsigned int ogappx, igappx; unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; @@ -249,6 +250,9 @@ static void setattach(const Arg *arg); static void setlayout(const Arg *arg); static void setcfact(const Arg *arg); static void setmfact(const Arg *arg); +static void setigappx(const Arg *arg); +static void setogappx(const Arg *arg); +static void gaptog(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); @@ -955,6 +959,8 @@ createmon(void) strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); strncpy(m->attsymbol, directions[attachdirection].symbol, strlen(directions[attachdirection].symbol) + 1); + m->ogappx = ogappx; + m->igappx = igappx; m->pertag = ecalloc(1, sizeof(Pertag)); m->pertag->curtag = m->pertag->prevtag = 1; @@ -2291,6 +2297,33 @@ setmfact(const Arg *arg) } void +setigappx(const Arg *arg) +{ + selmon->igappx += arg->i; + if (selmon->igappx < 0) selmon->igappx = 0; + arrange(selmon); +} + +void +setogappx(const Arg *arg) +{ + selmon->ogappx += arg->i; + if (selmon->ogappx < 0) selmon->ogappx = 0; + arrange(selmon); +} + +void +gaptog(const Arg *arg) +{ + if (selmon->ogappx == ogappx && selmon->igappx == igappx) { + selmon->ogappx = 0; selmon->igappx = 0; + } else { + selmon->ogappx = ogappx; selmon->igappx = igappx; + } + arrange(selmon); +} + +void setup(void) { int i; @@ -2513,15 +2546,18 @@ tile(Monitor *m) for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if (i < m->nmaster) { h = (m->wh - my) * (c->cfact / mfacts); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); + if (n <= m->nmaster) + resize(c, m->wx + m->ogappx, m->wy + my + m->ogappx, mw - (2*c->bw) - (2*m->ogappx), h - (2*c->bw) - (2*m->ogappx), 0); + else + resize(c, m->wx + m->ogappx, m->wy + my + m->ogappx, mw - (2*c->bw) - m->ogappx - m->igappx, h - (2*c->bw) - (2*m->ogappx), 0); if (my + HEIGHT(c) < m->wh) - my += HEIGHT(c); + my += HEIGHT(c) + (2*m->igappx); mfacts -= c->cfact; } else { h = (m->wh - ty) * (c->cfact / sfacts); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + resize(c, m->wx + mw + m->igappx, m->wy + ty + m->ogappx, m->ww - mw - (2*c->bw) - m->ogappx - m->igappx, h - (2*c->bw) - (2*m->ogappx), 0); if (ty + HEIGHT(c) < m->wh) - ty += HEIGHT(c); + ty += HEIGHT(c) + (2*m->igappx); sfacts -= c->cfact; } }