Return to repo list

suckless-gf-dwm

Gentoo-friendly patches for Suckless's dwm.
Return to HMagellan.com

commit 7d699478a1a749b6cf42994a77d8fc485fe5091c
parent a2eda92817a096f54e5319103a97839195f75c5e
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 11 Aug 2020 01:12:15 -0500

added focusonclick and bottomstack

Diffstat:
Abottomstack/USAGE | 37+++++++++++++++++++++++++++++++++++++
Abottomstack/bottomstack.patch | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcyclelayouts/USAGE | 4++--
Afocusonclick/USAGE | 26++++++++++++++++++++++++++
Afocusonclick/focusonclick.patch | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 262 insertions(+), 2 deletions(-)

diff --git a/bottomstack/USAGE b/bottomstack/USAGE @@ -0,0 +1,37 @@ +bottomstack - Two bottom-up-oriented layouts for dwm +Source: https://dwm.suckless.org/patches/bottomstack/ +Original Authors: Anselm R Garbe - anselm@garbe.us + Laslo Hunhold - dev@frign.de (6.1, git ports) + +Description from source: + """ + bstack and bstackhoriz are two stack layouts for dwm. + + bstack (TTT) bstackhoriz (===) + +-----------------+ +-----------------+ + | | | | + | | | | + | | | | + +-----+-----+-----+ +-----------------+ + | | | | +-----------------+ + | | | | +-----------------+ + +-----+-----+-----+ +-----------------+ + + bstack can be selected with [Alt]+[u], bstackhoriz with [Alt]+[o]. + """ + +== YOU MUST == +(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm' + +== YOU PROBABLY SHOULD == +(1). Add the following entries to your savedconfig file's layouts to gain access to + the new layouts: + + { "TTT", bstack }, + { "===", bstackhoriz }, + +(2). Add some way to switch to these layouts (e.g. with hotkeys like the default + layouts). + +== PATCH MODIFICATIONS == +(1). Removed lines relating to config.def.h diff --git a/bottomstack/bottomstack.patch b/bottomstack/bottomstack.patch @@ -0,0 +1,79 @@ +diff --git a/dwm.c b/dwm.c +index 0362114..c313b5e 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -233,6 +233,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"; +@@ -2139,3 +2141,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/cyclelayouts/USAGE b/cyclelayouts/USAGE @@ -1,6 +1,6 @@ cyclelayouts - Cycles through all available layouts Source: https://dwm.suckless.org/patches/cyclelayouts/ -Original Autor: cd +Original Author: cd Description from source: """ @@ -19,7 +19,7 @@ Description from source: (1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm' (2). Add an entry at the end of your layout list in your savedconfig file that looks like this: - { NULL, NULL }, + { NULL, NULL }, Note that this MUST be the last layout in your list! diff --git a/focusonclick/USAGE b/focusonclick/USAGE @@ -0,0 +1,26 @@ +focusonclick - Switch focus only on mouse click +Source: https://dwm.suckless.org/patches/focusonclick/ +Original Authors: Wolfgang S. - ezzieyguywuf at gmail . com (added 6aa8e37 patch fix) + Markus P. - peters_mops at arcor . de + Eric Pruitt - added option to disable focus changing with the scroll wheel + Alessandro Di Martino - Maintainer of the 6.0 version. + Markus Teich - Update and fix + +Description from source: + """ + Switch focus only by mouse click and not sloppy. + """ + +== YOU MUST == +(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm' +(2). Add a line to your savedconfig file that looks like this: + + static const int focusonwheel = 0; + + It can be equal to either 0 (for no focus on mouse wheel click) or 1 (for the opposite). + +== YOU PROBABLY SHOULD == +No need for other changes. + +== PATCH MODIFICATIONS == +(1). Removed lines relating to config.def.h diff --git a/focusonclick/focusonclick.patch b/focusonclick/focusonclick.patch @@ -0,0 +1,118 @@ +diff --git a/dwm.c b/dwm.c +index 4782343..4e9296d 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -164,7 +164,6 @@ static void detachstack(Client *c); + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); +-static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); + static void focusin(XEvent *e); +@@ -182,7 +181,6 @@ static void manage(Window w, XWindowAttributes *wa); + static void mappingnotify(XEvent *e); + static void maprequest(XEvent *e); + static void monocle(Monitor *m); +-static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); + static Client *nexttiled(Client *c); + static void pop(Client *); +@@ -250,13 +248,11 @@ static void (*handler[LASTEvent]) (XEvent *) = { + [ConfigureRequest] = configurerequest, + [ConfigureNotify] = configurenotify, + [DestroyNotify] = destroynotify, +- [EnterNotify] = enternotify, + [Expose] = expose, + [FocusIn] = focusin, + [KeyPress] = keypress, + [MappingNotify] = mappingnotify, + [MapRequest] = maprequest, +- [MotionNotify] = motionnotify, + [PropertyNotify] = propertynotify, + [UnmapNotify] = unmapnotify + }; +@@ -425,7 +421,8 @@ buttonpress(XEvent *e) + + click = ClkRootWin; + /* focus monitor if necessary */ +- if ((m = wintomon(ev->window)) && m != selmon) { ++ if ((m = wintomon(ev->window)) && m != selmon ++ && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); +@@ -445,10 +442,10 @@ buttonpress(XEvent *e) + else + click = ClkWinTitle; + } else if ((c = wintoclient(ev->window))) { +- focus(c); +- restack(selmon); +- XAllowEvents(dpy, ReplayPointer, CurrentTime); +- click = ClkClientWin; ++ if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) ++ focus(c); ++ XAllowEvents(dpy, ReplayPointer, CurrentTime); ++ click = ClkClientWin; + } + for (i = 0; i < LENGTH(buttons); i++) + if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button +@@ -753,25 +750,6 @@ drawbars(void) + } + + void +-enternotify(XEvent *e) +-{ +- Client *c; +- Monitor *m; +- XCrossingEvent *ev = &e->xcrossing; +- +- if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) +- return; +- c = wintoclient(ev->window); +- m = c ? c->mon : wintomon(ev->window); +- if (m != selmon) { +- unfocus(selmon->sel, 1); +- selmon = m; +- } else if (!c || c == selmon->sel) +- return; +- focus(c); +-} +- +-void + expose(XEvent *e) + { + Monitor *m; +@@ -943,7 +921,7 @@ grabbuttons(Client *c, int focused) + XGrabButton(dpy, buttons[i].button, + buttons[i].mask | modifiers[j], + c->win, False, BUTTONMASK, +- GrabModeAsync, GrabModeSync, None, None); ++ GrabModeSync, GrabModeSync, None, None); + } + } + +@@ -1118,23 +1096,6 @@ monocle(Monitor *m) + } + + void +-motionnotify(XEvent *e) +-{ +- static Monitor *mon = NULL; +- Monitor *m; +- XMotionEvent *ev = &e->xmotion; +- +- if (ev->window != root) +- return; +- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { +- unfocus(selmon->sel, 1); +- selmon = m; +- focus(NULL); +- } +- mon = m; +-} +- +-void + movemouse(const Arg *arg) + { + int x, y, ocx, ocy, nx, ny;