diff --git a/Makefile b/Makefile index 86d612d..00eeeb8 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,7 @@ all: dwm .c.o: ${CC} -c ${CFLAGS} $< -${OBJ}: config.h config.mk - -config.h: - cp config.def.h $@ +${OBJ}: config.def.h config.mk dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} diff --git a/config.def.h b/config.def.h index 0b42df7..25f29c3 100644 --- a/config.def.h +++ b/config.def.h @@ -20,7 +20,8 @@ void toggle_keyboard_layout(const Arg* arg) { // Normal config.def.h continues. I just added some of my own functions /* 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 = 2; /* gap pixel 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 */ @@ -81,8 +82,8 @@ static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_space, toggle_keyboard_layout, {0} }, { MODKEY, XK_r, spawn, {.v = dmenucmd } }, - { MODKEY|ControlMask, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_Return, spawn, {.v = termtmuxzshcmd } }, + { MODKEY|ControlMask, XK_s, spawn, {.v = termcmd } }, + { MODKEY, XK_s, spawn, {.v = termtmuxzshcmd } }, { MODKEY|ControlMask, XK_n, spawn, {.v = flexcmd } }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_k, focusstack, {.i = +1 } }, @@ -91,14 +92,14 @@ static const Key keys[] = { { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_j, setmfact, {.f = -0.05} }, { MODKEY, XK_semicolon , setmfact, {.f = +0.05} }, - { MODKEY|ControlMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|Mod1Mask , XK_c, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, //{ MODKEY, XK_space, setlayout, {0} }, - //{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ControlMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, diff --git a/dwm.c b/dwm.c index 1443802..7b6415a 100644 --- a/dwm.c +++ b/dwm.c @@ -268,7 +268,7 @@ static Monitor *mons, *selmon; static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ -#include "config.h" +#include "config.def.h" /* compile-time check if all tags fit into an unsigned int bit array. */ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; @@ -1683,31 +1683,32 @@ tagmon(const Arg *arg) sendmon(selmon->sel, dirtomon(arg->i)); } +// Note: There was thishuge conflict with 6.0+gaps patch and I merged it almost blindly. Have no guarantees that it willwork correctly void -tile(Monitor *m) -{ - unsigned int i, n, h, mw, my, ty; +tile(Monitor *m) { + unsigned int i, n, h, r, g = 0, mw, my, ty; Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); if (n == 0) return; - if (n > m->nmaster) - mw = m->nmaster ? m->ww * m->mfact : 0; + if(n > m->nmaster) + mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0; else mw = m->ww; - for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - h = (m->wh - my) / (MIN(n, m->nmaster) - i); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - if (my + HEIGHT(c) < m->wh) - my += HEIGHT(c); - } else { - h = (m->wh - ty) / (n - i); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); - if (ty + HEIGHT(c) < m->wh) - ty += HEIGHT(c); + for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if(i < m->nmaster) { + r = MIN(n, m->nmaster) - i; + h = (m->wh - my - gappx * (r - 1)) / r; + resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); + my += HEIGHT(c) + gappx; + } + else { + r = n - i; + h = (m->wh - ty - gappx * (r - 1)) / r; + resize(c, m->wx + mw + g, m->wy + ty, m->ww - mw - g - (2*c->bw), h - (2*c->bw), False); + ty += HEIGHT(c) + gappx; } }