diff --git a/README.md b/README.md index 36319e3..18c3ba5 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,56 @@ # dwm -This is my patched version of dwm. The base version is directly from suckless.org. -This belongs to my larbs installation script and depends heavily on its scripts and programs. + +This is my patched version of dwm. The base version is directly from +suckless.org. +This belongs to my larbs installation script and depends heavily on its scripts +and programs. It is supposed to work in the environment after the larbs-base-installation. ## Patches + The list below shows the currently applied patches to the master branch. + - dwm-actualfullscreen-20191112-cb3f58a.diff (enables true fullscreen) +- dwm-bottomstack-20160719-56a31dc.diff (adds bottomstack and +bottomstackhorizontal layout) - dwm-center-6.1.diff (adds ability to center floating windows at launch) - dwm-deck-6.0.diff (adds deck layout) - dwm-noborder-6.2.diff (removes border if there is only one window) -- dwm-pertag-20170513-ceac8c9.diff (allows having a layout/mwfact/barpos/nmaster per tag) +- dwm-pertag-20170513-ceac8c9.diff (allows having a layout/mwfact/barpos/nmaster +per tag) - dwm-statuscmd-6.2.diff (enables dwmblocks compatibility) ## Hotkeys -There are various shortcuts and hotkeys used in this version. Included in my build are the following. -| ModKey | Shift | Key | Function | -| ------ | ----- | ----------------- | --------------------------------------------------------- | -| Super | Shift | Escape | Quit dwm | -| Super | Shift | b | Toggle dwmbar | -| Super | Shift | c | Enable deck(/card) layout | -| Super | Shift | d | Toggle floating/tiled for selected window | -| Super | Shift | f | Toggle fullscreen | -| Super | | h | (Tiling/Deck) Focus window higher in stack than current | -| Super | Shift | h | (Tiling/Deck) Make current window the master window | -| Super | | j | (Tiling/Deck) Focus window lower in stack than current | -| Super | Shift | j | (Tiling/Deck) Make current window the master window | -| Super | | k | (Tiling/Deck) Focus window higher in stack than current | -| Super | Shift | k | (Tiling/Deck) Make current window the master window | -| Super | | l | (Tiling/Deck) Focus window lower in stack than current | -| Super | Shift | m | Enable monocle layout | -| Super | Shift | o | (Tiling/Deck) Increase master window size | -| Super | | q | Close current window | -| Super | Shift | t | Enable tiling layout | -| Super | Shift | z | (Tiling/Deck) Decrease master window size | -| Super | | 0 | Show all tags | -| Super | Shift | 0 | Add current window to all tag | -| Super | | 1/2/.../9 | Show tag 1/2/.../9 | -| Super | Shift | 1/2/.../9 | Add current window to tag 1/2/.../9 | -| Super | | . | Show monitor lower in stack | -| Super | Shift | . | Add to monitor lower in stack | -| Super | | , | Show monitor higher in stack | -| Super | Shift | , | Add to monitor higher in stack | + +There are various shortcuts and hotkeys used in this version. Included in my +build are the following. + +| ModKey | Shift | Key | Function | +| ------ | ----- | --- | -------- | +| Super | Shift | Escape | Quit dwm | +| Super | Shift | b | Toggle dwmbar | +| Super | Shift | c | Enable deck(/card) layout | +| Super | Shift | d | Toggle floating/tiled for selected window | +| Super | Shift | f | Toggle fullscreen | +| Super | | h | (Tiling/Deck) Focus window higher in stack than current | +| Super | Shift | h | (Tiling/Deck) Make current window the master window | +| Super | | j | (Tiling/Deck) Focus window lower in stack than current | +| Super | Shift | j | (Tiling/Deck) Make current window the master window | +| Super | | k | (Tiling/Deck) Focus window higher in stack than current | +| Super | Shift | k | (Tiling/Deck) Make current window the master window | +| Super | | l | (Tiling/Deck) Focus window lower in stack than current | +| Super | Shift | m | Enable monocle layout | +| Super | Shift | o | (Tiling/Deck) Increase master window size | +| Super | | q | Close current window | +| Super | Shift | t | Enable tiling layout | +| Super | Shift | u | Enable bottomstack layout | +| Super | Shift | v | Enable bottomstackhorizontal layout | +| Super | Shift | z | (Tiling/Deck) Decrease master window size | +| Super | | 0 | Show all tags | +| Super | Shift | 0 | Add current window to all tag | +| Super | | 1/2/.../9 | Show tag 1/2/.../9 | +| Super | Shift | 1/2/.../9 | Add current window to tag 1/2/.../9 | +| Super | | . | Show monitor lower in stack | +| Super | Shift | . | Add to monitor lower in stack | +| Super | | , | Show monitor higher in stack | +| Super | Shift | , | Add to monitor higher in stack | diff --git a/config.def.h b/config.def.h index cbfee35..7a4d75d 100644 --- a/config.def.h +++ b/config.def.h @@ -45,6 +45,8 @@ static const Layout layouts[] = { { "M", monocle }, { "T", tile }, /* first entry is default */ { "D", deck }, + { "B", bstack }, + { "=", bstackhoriz }, { "F", NULL }, /* no layout function means floating behavior */ }; @@ -77,10 +79,12 @@ static Key keys[] = { { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_k, zoom, {0} }, { MODKEY, XK_l, focusstack, {.i = +1 } }, - { MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[0]} }, + { MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[0]} }, { MODKEY|ShiftMask, XK_o, setmfact, {.f = +0.05} }, - { MODKEY, XK_q, killclient, {0} }, + { MODKEY, XK_q, killclient, {0} }, { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, + { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[3]} }, + { MODKEY|ShiftMask, XK_v, setlayout, {.v = &layouts[4]} }, { MODKEY|ShiftMask, XK_z, setmfact, {.f = -0.05} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, @@ -88,9 +92,9 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - //{ MODKEY|ShiftMask, XK_o, incnmaster, {.i = +1 } }, - //{ MODKEY|ShiftMask, XK_z, incnmaster, {.i = -1 } }, - //{ MODKEY, XK_space, setlayout, {0} }, + //{ MODKEY|ShiftMask, XK_o, incnmaster, {.i = +1 } }, + //{ MODKEY|ShiftMask, XK_z, incnmaster, {.i = -1 } }, + //{ MODKEY, XK_space, setlayout, {0} }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) diff --git a/dwm-bottomstack-20160719-56a31dc.diff b/dwm-bottomstack-20160719-56a31dc.diff new file mode 100644 index 0000000..d982817 --- /dev/null +++ b/dwm-bottomstack-20160719-56a31dc.diff @@ -0,0 +1,101 @@ +diff --git a/config.def.h b/config.def.h +index fd77a07..c3a044b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -41,6 +41,8 @@ static const Layout layouts[] = { + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "TTT", bstack }, ++ { "===", bstackhoriz }, + }; + + /* key definitions */ +@@ -76,6 +78,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 } }, +diff --git a/dwm.c b/dwm.c +index b2bc9bd..8b74165 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -234,6 +234,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"; +@@ -2138,3 +2140,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/dwm.c b/dwm.c index 0eb6c40..fa6b569 100644 --- a/dwm.c +++ b/dwm.c @@ -241,6 +241,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"; @@ -2340,3 +2342,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); + } + } +}