diff options
author | Joe <bousset.rudy@gmail.com> | 2022-08-12 12:40:18 +0200 |
---|---|---|
committer | Joe <bousset.rudy@gmail.com> | 2022-08-12 12:40:18 +0200 |
commit | bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c (patch) | |
tree | bdff1d887754aa975cc0bcc98787d129234038c8 | |
parent | gaps update (diff) | |
download | dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.gz dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.bz2 dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.xz dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.tar.zst dwm-bc0b589fcc3592ab1d7b420a4a47f5a10fa9464c.zip |
update
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | applied/dwm-actualfullscreen-20211013-cb3f58a.diff | 68 | ||||
-rw-r--r-- | applied/dwm-alwayscenter-20200625-f04cac6.diff | 12 | ||||
-rw-r--r-- | applied/dwm-attachasideandbelow-20200702-f04cac6.diff | 100 | ||||
-rw-r--r-- | applied/dwm-bartabgroups-20210802-138b405.diff | 187 | ||||
-rw-r--r-- | applied/dwm-centeredmaster-6.1.diff | 142 | ||||
-rw-r--r-- | applied/dwm-focusonclick-20200110-61bb8b2.diff | 130 | ||||
-rw-r--r-- | applied/dwm-fullgaps-20200508-7b77734.diff | 111 | ||||
-rw-r--r-- | applied/dwm-movestack-20211115-a786211.diff | 95 | ||||
-rw-r--r-- | applied/dwm-noborder-6.2.diff | 30 | ||||
-rw-r--r-- | applied/dwm-pertag-20200914-61bb8b2.diff | 177 | ||||
-rw-r--r-- | applied/dwm-savefloats-20181212-b69c870.diff | 42 | ||||
-rw-r--r-- | applied/dwm-sizehints-isfreesize-6.2.diff | 103 | ||||
-rw-r--r-- | applied/dwm-switchtotag-6.2.diff | 58 | ||||
-rw-r--r-- | applied/dwm-tagothermonitor-6.2.diff | 80 | ||||
-rw-r--r-- | config.def.h | 11 | ||||
-rw-r--r-- | config.h | 11 | ||||
-rw-r--r-- | dwm.c | 112 |
18 files changed, 1458 insertions, 12 deletions
@@ -122,7 +122,6 @@ flycheck_*.el # End of https://www.gitignore.io/api/c,linux,emacs -*.diff *.o *.rej *.orig diff --git a/applied/dwm-actualfullscreen-20211013-cb3f58a.diff b/applied/dwm-actualfullscreen-20211013-cb3f58a.diff new file mode 100644 index 0000000..d3be230 --- /dev/null +++ b/applied/dwm-actualfullscreen-20211013-cb3f58a.diff @@ -0,0 +1,68 @@ +From eea13010ffc3983392857ee1e3804e3aa1064d7a Mon Sep 17 00:00:00 2001 +From: Soenke Lambert <s.lambert@mittwald.de> +Date: Wed, 13 Oct 2021 18:21:09 +0200 +Subject: [PATCH] Fullscreen current window with [Alt]+[Shift]+[f] + +This actually fullscreens a window, instead of just hiding the statusbar +and applying the monocle layout. +--- + config.def.h | 1 + + dwm.1 | 3 +++ + dwm.c | 8 ++++++++ + 3 files changed, 12 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..8cd3204 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -78,6 +78,7 @@ static Key keys[] = { + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, ++ { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, +diff --git a/dwm.1 b/dwm.1 +index 13b3729..a368d05 100644 +--- a/dwm.1 ++++ b/dwm.1 +@@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only). + .B Mod1\-Shift\-c + Close focused window. + .TP ++.B Mod1\-Shift\-f ++Toggle fullscreen for focused window. ++.TP + .B Mod1\-Shift\-space + Toggle focused window between tiled and floating state. + .TP +diff --git a/dwm.c b/dwm.c +index 4465af1..c1b899a 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); + static void tile(Monitor *); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglefullscr(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -1719,6 +1720,13 @@ togglefloating(const Arg *arg) + arrange(selmon); + } + ++void ++togglefullscr(const Arg *arg) ++{ ++ if(selmon->sel) ++ setfullscreen(selmon->sel, !selmon->sel->isfullscreen); ++} ++ + void + toggletag(const Arg *arg) + { +-- +2.30.2 + diff --git a/applied/dwm-alwayscenter-20200625-f04cac6.diff b/applied/dwm-alwayscenter-20200625-f04cac6.diff new file mode 100644 index 0000000..03ea9ef --- /dev/null +++ b/applied/dwm-alwayscenter-20200625-f04cac6.diff @@ -0,0 +1,12 @@ +diff -up dwm/dwm.c dwmmod/dwm.c +--- dwm/dwm.c 2020-06-25 00:21:30.383692180 -0300 ++++ dwmmod/dwm.c 2020-06-25 00:20:35.643692330 -0300 +@@ -1057,6 +1057,8 @@ manage(Window w, XWindowAttributes *wa) + updatewindowtype(c); + updatesizehints(c); + updatewmhints(c); ++ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; ++ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); + grabbuttons(c, 0); + if (!c->isfloating) diff --git a/applied/dwm-attachasideandbelow-20200702-f04cac6.diff b/applied/dwm-attachasideandbelow-20200702-f04cac6.diff new file mode 100644 index 0000000..1b9219d --- /dev/null +++ b/applied/dwm-attachasideandbelow-20200702-f04cac6.diff @@ -0,0 +1,100 @@ +diff -up b/dwm.c a/dwm.c +--- b/dwm.c 2020-07-05 16:05:02.555947738 -0300 ++++ a/dwm.c 2020-07-05 16:06:19.592609932 -0300 +@@ -49,7 +49,8 @@ + #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) + #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) +-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) ++#define ISVISIBLEONTAG(C, T) ((C->tags & T)) ++#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) + #define LENGTH(X) (sizeof X / sizeof X[0]) + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) + #define WIDTH(X) ((X)->w + 2 * (X)->bw) +@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int + static void arrange(Monitor *m); + static void arrangemon(Monitor *m); + static void attach(Client *c); ++static void attachBelow(Client *c); + static void attachstack(Client *c); + static void buttonpress(XEvent *e); + static void checkotherwm(void); +@@ -184,6 +186,7 @@ static void maprequest(XEvent *e); + static void monocle(Monitor *m); + static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); ++static Client *nexttagged(Client *c); + static Client *nexttiled(Client *c); + static void pop(Client *); + static void propertynotify(XEvent *e); +@@ -406,6 +409,27 @@ attach(Client *c) + c->next = c->mon->clients; + c->mon->clients = c; + } ++void ++attachBelow(Client *c) ++{ ++ //If there is nothing on the monitor or the selected client is floating, attach as normal ++ if(c->mon->sel == NULL || c->mon->sel->isfloating) { ++ Client *at = nexttagged(c); ++ if(!at) { ++ attach(c); ++ return; ++ } ++ c->next = at->next; ++ at->next = c; ++ return; ++ } ++ ++ //Set the new client's next property to the same as the currently selected clients next ++ c->next = c->mon->sel->next; ++ //Set the currently selected clients next property to the new client ++ c->mon->sel->next = c; ++ ++} + + void + attachstack(Client *c) +@@ -1063,7 +1087,7 @@ manage(Window w, XWindowAttributes *wa) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) + XRaiseWindow(dpy, c->win); +- attach(c); ++ attachBelow(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +@@ -1193,6 +1217,16 @@ movemouse(const Arg *arg) + } + } + ++ Client * ++nexttagged(Client *c) { ++ Client *walked = c->mon->clients; ++ for(; ++ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags)); ++ walked = walked->next ++ ); ++ return walked; ++} ++ + Client * + nexttiled(Client *c) + { +@@ -1418,7 +1452,7 @@ sendmon(Client *c, Monitor *m) + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ +- attach(c); ++ attachBelow(c); + attachstack(c); + focus(NULL); + arrange(NULL); +@@ -1901,6 +1935,7 @@ updategeom(void) + detachstack(c); + c->mon = mons; + attach(c); ++ attachBelow(c); + attachstack(c); + } + if (m == selmon) diff --git a/applied/dwm-bartabgroups-20210802-138b405.diff b/applied/dwm-bartabgroups-20210802-138b405.diff new file mode 100644 index 0000000..fc275f3 --- /dev/null +++ b/applied/dwm-bartabgroups-20210802-138b405.diff @@ -0,0 +1,187 @@ +From 653c99b94cc780a2def9c7e50a87703156535f8b Mon Sep 17 00:00:00 2001 +From: Jack Bird <jack.bird@durham.ac.uk> +Date: Mon, 2 Aug 2021 18:50:02 +0100 +Subject: [PATCH] bartabgroups updated to work with 138b405 + +--- + config.def.h | 11 +++++ + dwm.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 112 insertions(+), 11 deletions(-) + +diff --git a/config.def.h b/config.def.h +index a2ac963..82accf1 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -16,6 +16,8 @@ static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, ++ [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } + }; + + /* tagging */ +@@ -37,6 +39,15 @@ static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + ++/* Bartabgroups properties */ ++#define BARTAB_BORDERS 1 // 0 = off, 1 = on ++#define BARTAB_BOTTOMBORDER 1 // 0 = off, 1 = on ++#define BARTAB_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on ++#define BARTAB_TAGSPX 5 // # pixels for tag grid boxes ++#define BARTAB_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) ++static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; ++static void (*bartabfloatfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; ++ + static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ +diff --git a/dwm.c b/dwm.c +index 5e4d494..1839a56 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -59,7 +59,7 @@ + + /* enums */ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +-enum { SchemeNorm, SchemeSel }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeTabActive, SchemeTabInactive }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ +@@ -378,6 +378,98 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) + return *x != c->x || *y != c->y || *w != c->w || *h != c->h; + } + ++void ++bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive) { ++ if (!c) return; ++ int i, nclienttags = 0, nviewtags = 0; ++ ++ drw_setscheme(drw, scheme[ ++ m->sel == c ? SchemeSel : (groupactive ? SchemeTabActive: SchemeTabInactive) ++ ]); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, c->name, 0); ++ ++ // Floating win indicator ++ if (c->isfloating) drw_rect(drw, x + 2, 2, 5, 5, 0, 0); ++ ++ // Optional borders between tabs ++ if (BARTAB_BORDERS) { ++ XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBorder].pixel); ++ XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, 0, 1, bh); ++ XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w, 0, 1, bh); ++ } ++ ++ // Optional tags icons ++ for (i = 0; i < LENGTH(tags); i++) { ++ if ((m->tagset[m->seltags] >> i) & 1) { nviewtags++; } ++ if ((c->tags >> i) & 1) { nclienttags++; } ++ } ++ if (BARTAB_TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1) { ++ for (i = 0; i < LENGTH(tags); i++) { ++ drw_rect(drw, ++ ( x + w - 2 - ((LENGTH(tags) / BARTAB_TAGSROWS) * BARTAB_TAGSPX) ++ - (i % (LENGTH(tags)/BARTAB_TAGSROWS)) + ((i % (LENGTH(tags) / BARTAB_TAGSROWS)) * BARTAB_TAGSPX) ++ ), ++ ( 2 + ((i / (LENGTH(tags)/BARTAB_TAGSROWS)) * BARTAB_TAGSPX) ++ - ((i / (LENGTH(tags)/BARTAB_TAGSROWS))) ++ ), ++ BARTAB_TAGSPX, BARTAB_TAGSPX, (c->tags >> i) & 1, 0 ++ ); ++ } ++ } ++} ++ ++void ++battabclick(Monitor *m, Client *c, int passx, int x, int w, int unused) { ++ if (passx >= x && passx <= x + w) { ++ focus(c); ++ restack(selmon); ++ } ++} ++ ++void ++bartabcalculate( ++ Monitor *m, int offx, int sw, int passx, ++ void(*tabfn)(Monitor *, Client *, int, int, int, int) ++) { ++ Client *c; ++ int ++ i, clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, ++ masteractive = 0, fulllayout = 0, floatlayout = 0, ++ x, w, tgactive; ++ ++ for (i = 0, c = m->clients; c; c = c->next) { ++ if (!ISVISIBLE(c)) continue; ++ if (c->isfloating) { clientsnfloating++; continue; } ++ if (m->sel == c) { masteractive = i < m->nmaster; } ++ if (i < m->nmaster) { clientsnmaster++; } else { clientsnstack++; } ++ i++; ++ } ++ for (i = 0; i < LENGTH(bartabfloatfns); i++) if (m ->lt[m->sellt]->arrange == bartabfloatfns[i]) { floatlayout = 1; break; } ++ for (i = 0; i < LENGTH(bartabmonfns); i++) if (m ->lt[m->sellt]->arrange == bartabmonfns[i]) { fulllayout = 1; break; } ++ for (c = m->clients, i = 0; c; c = c->next) { ++ if (!ISVISIBLE(c)) continue; ++ if (clientsnmaster + clientsnstack == 0 || floatlayout) { ++ x = offx + (((m->mw - offx - sw) / (clientsnmaster + clientsnstack + clientsnfloating)) * i); ++ w = (m->mw - offx - sw) / (clientsnmaster + clientsnstack + clientsnfloating); ++ tgactive = 1; ++ } else if (!c->isfloating && (fulllayout || ((clientsnmaster == 0) ^ (clientsnstack == 0)))) { ++ x = offx + (((m->mw - offx - sw) / (clientsnmaster + clientsnstack)) * i); ++ w = (m->mw - offx - sw) / (clientsnmaster + clientsnstack); ++ tgactive = 1; ++ } else if (i < m->nmaster && !c->isfloating) { ++ x = offx + ((((m->mw * m->mfact) - offx) /clientsnmaster) * i); ++ w = ((m->mw * m->mfact) - offx) / clientsnmaster; ++ tgactive = masteractive; ++ } else if (!c->isfloating) { ++ x = (m->mw * m->mfact) + ((((m->mw * (1 - m->mfact)) - sw) / clientsnstack) * (i - m->nmaster)); ++ w = ((m->mw * (1 - m->mfact)) - sw) / clientsnstack; ++ tgactive = !masteractive; ++ } else continue; ++ tabfn(m, c, passx, x, w, tgactive); ++ i++; ++ } ++} ++ + void + arrange(Monitor *m) + { +@@ -442,8 +534,8 @@ buttonpress(XEvent *e) + click = ClkLtSymbol; + else if (ev->x > selmon->ww - (int)TEXTW(stext)) + click = ClkStatusText; +- else +- click = ClkWinTitle; ++ else // Focus clicked tab bar item ++ bartabcalculate(selmon, x, TEXTW(stext) - lrpad + 2, ev->x, battabclick); + } else if ((c = wintoclient(ev->window))) { + focus(c); + restack(selmon); +@@ -729,15 +821,13 @@ drawbar(Monitor *m) + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + ++ // Draw bartabgroups ++ drw_rect(drw, x, 0, m->ww - tw - x, bh, 1, 1); + if ((w = m->ww - tw - x) > bh) { +- if (m->sel) { +- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); +- if (m->sel->isfloating) +- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); +- } else { +- drw_setscheme(drw, scheme[SchemeNorm]); +- drw_rect(drw, x, 0, w, bh, 1, 1); ++ bartabcalculate(m, x, tw, -1, bartabdraw); ++ if (BARTAB_BOTTOMBORDER) { ++ drw_setscheme(drw, scheme[SchemeTabActive]); ++ drw_rect(drw, 0, bh - 1, m->ww, 1, 1, 0); + } + } + drw_map(drw, m->barwin, 0, 0, m->ww, bh); +-- +2.32.0 + diff --git a/applied/dwm-centeredmaster-6.1.diff b/applied/dwm-centeredmaster-6.1.diff new file mode 100644 index 0000000..6926892 --- /dev/null +++ b/applied/dwm-centeredmaster-6.1.diff @@ -0,0 +1,142 @@ +diff --git a/config.def.h b/config.def.h +index 7054c06..527b214 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -39,6 +39,8 @@ static const Layout layouts[] = { + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "|M|", centeredmaster }, ++ { ">M>", centeredfloatingmaster }, + }; + + /* key definitions */ +@@ -74,6 +76,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 0362114..1e81412 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 centeredmaster(Monitor *m); ++static void centeredfloatingmaster(Monitor *m); + + /* variables */ + static const char broken[] = "broken"; +@@ -2139,3 +2141,106 @@ main(int argc, char *argv[]) + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ ++void ++centeredmaster(Monitor *m) ++{ ++ unsigned int i, n, h, mw, mx, my, oty, ety, tw; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize areas */ ++ mw = m->ww; ++ mx = 0; ++ my = 0; ++ tw = mw; ++ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ tw = m->ww - mw; ++ ++ if (n - m->nmaster > 1) { ++ /* only one client */ ++ mx = (m->ww - mw) / 2; ++ tw = (m->ww - mw) / 2; ++ } ++ } ++ ++ oty = 0; ++ ety = 0; ++ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked vertically, in the center ++ * of the screen */ ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw), ++ h - (2*c->bw), 0); ++ my += HEIGHT(c); ++ } else { ++ /* stack clients are stacked vertically */ ++ if ((i - m->nmaster) % 2 ) { ++ h = (m->wh - ety) / ( (1 + n - i) / 2); ++ resize(c, m->wx, m->wy + ety, tw - (2*c->bw), ++ h - (2*c->bw), 0); ++ ety += HEIGHT(c); ++ } else { ++ h = (m->wh - oty) / ((1 + n - i) / 2); ++ resize(c, m->wx + mx + mw, m->wy + oty, ++ tw - (2*c->bw), h - (2*c->bw), 0); ++ oty += HEIGHT(c); ++ } ++ } ++} ++ ++void ++centeredfloatingmaster(Monitor *m) ++{ ++ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize nmaster area */ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ if (m->ww > m->wh) { ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ mh = m->nmaster ? m->wh * 0.9 : 0; ++ } else { ++ mh = m->nmaster ? m->wh * m->mfact : 0; ++ mw = m->nmaster ? m->ww * 0.9 : 0; ++ } ++ mx = mxo = (m->ww - mw) / 2; ++ my = myo = (m->wh - mh) / 2; ++ } else { ++ /* go fullscreen if all clients are in the master area */ ++ mh = m->wh; ++ mw = m->ww; ++ mx = mxo = 0; ++ my = myo = 0; ++ } ++ ++ for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked horizontally, in the center ++ * of the screen */ ++ w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), ++ mh - (2*c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ /* stack clients are stacked horizontally */ ++ w = (m->ww - tx) / (n - i); ++ resize(c, m->wx + tx, m->wy, w - (2*c->bw), ++ m->wh - (2*c->bw), 0); ++ tx += WIDTH(c); ++ } ++} diff --git a/applied/dwm-focusonclick-20200110-61bb8b2.diff b/applied/dwm-focusonclick-20200110-61bb8b2.diff new file mode 100644 index 0000000..59c7a1d --- /dev/null +++ b/applied/dwm-focusonclick-20200110-61bb8b2.diff @@ -0,0 +1,130 @@ +From 7ac0b812540e21b470f2f6947c6cc1e30bf24b42 Mon Sep 17 00:00:00 2001 +From: iofq <cjriddz@protonmail.com> +Date: Sun, 10 Jan 2021 22:43:16 -0600 +Subject: [PATCH] tweak fixes floating window mouse controls + +--- + config.def.h | 1 + + dwm.c | 47 ++++------------------------------------------- + 2 files changed, 5 insertions(+), 43 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..4f2c946 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of 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 */ ++static const int focusonwheel = 0; + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +diff --git a/dwm.c b/dwm.c +index 664c527..de3e883 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -163,7 +163,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,8 +442,8 @@ buttonpress(XEvent *e) + else + click = ClkWinTitle; + } else if ((c = wintoclient(ev->window))) { +- focus(c); +- restack(selmon); ++ if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) ++ focus(c); + XAllowEvents(dpy, ReplayPointer, CurrentTime); + click = ClkClientWin; + } +@@ -752,25 +749,6 @@ drawbars(void) + drawbar(m); + } + +-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) + { +@@ -1116,23 +1094,6 @@ monocle(Monitor *m) + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); + } + +-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) + { +-- +2.30.0 + diff --git a/applied/dwm-fullgaps-20200508-7b77734.diff b/applied/dwm-fullgaps-20200508-7b77734.diff new file mode 100644 index 0000000..29bd6dc --- /dev/null +++ b/applied/dwm-fullgaps-20200508-7b77734.diff @@ -0,0 +1,111 @@ +From 7b7773458c072e4b24d6ea32d0364a8e402e4a43 Mon Sep 17 00:00:00 2001 +From: swy7ch <swy7ch@protonmail.com> +Date: Fri, 8 May 2020 19:07:24 +0200 +Subject: [PATCH] [PATCH] update dwm-fullgaps patch to be used with tile layout + update + +the recent tile layout changes in commit HEAD~1 (f09418b) broke the +patch + +this patch adapt the new `if` statements to take gaps into account + +this patch also provides manpage entries for the keybindings +--- +diff --git a/dwm.1 b/dwm.1 +index 13b3729..0202d96 100644 +--- a/dwm.1 ++++ b/dwm.1 +@@ -140,6 +140,16 @@ View all windows with any tag. + .B Mod1\-Control\-[1..n] + Add/remove all windows with nth tag to/from the view. + .TP ++.B Mod1\-- ++Decrease the gaps around windows. ++.TP ++.B Mod1\-= ++Increase the gaps around windows. ++.TP ++.B Mod1\-Shift-= ++Reset the gaps around windows to ++.BR 0 . ++.TP + .B Mod1\-Shift\-q + Quit dwm. + .SS Mouse commands +diff --git a/dwm.c b/dwm.c +index 9fd0286..45a58f3 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -119,6 +119,7 @@ struct Monitor { + int by; /* bar geometry */ + int mx, my, mw, mh; /* screen size */ + int wx, wy, ww, wh; /* window area */ ++ int gappx; /* gaps between windows */ + unsigned int seltags; + unsigned int sellt; + unsigned int tagset[2]; +@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); ++static void setgaps(const Arg *arg); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); + static void setup(void); +@@ -639,6 +641,7 @@ createmon(void) + m->nmaster = nmaster; + m->showbar = showbar; + m->topbar = topbar; ++ m->gappx = gappx; + m->lt[0] = &layouts[0]; + m->lt[1] = &layouts[1 % LENGTH(layouts)]; + strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); +@@ -1498,6 +1501,16 @@ setfullscreen(Client *c, int fullscreen) + } + } + ++void ++setgaps(const Arg *arg) ++{ ++ if ((arg->i == 0) || (selmon->gappx + arg->i < 0)) ++ selmon->gappx = 0; ++ else ++ selmon->gappx += arg->i; ++ arrange(selmon); ++} ++ + void + setlayout(const Arg *arg) + { +@@ -1684,18 +1697,18 @@ tile(Monitor *m) + if (n > m->nmaster) + mw = m->nmaster ? m->ww * m->mfact : 0; + else +- mw = m->ww; +- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ mw = m->ww - m->gappx; ++ for (i = 0, my = ty = m->gappx, 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); ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; ++ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); ++ if (my + HEIGHT(c) + m->gappx < m->wh) ++ my += HEIGHT(c) + m->gappx; + } 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); ++ h = (m->wh - ty) / (n - i) - m->gappx; ++ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); ++ if (ty + HEIGHT(c) + m->gappx < m->wh) ++ ty += HEIGHT(c) + m->gappx; + } + } + +-- +2.26.2 + diff --git a/applied/dwm-movestack-20211115-a786211.diff b/applied/dwm-movestack-20211115-a786211.diff new file mode 100644 index 0000000..134abb8 --- /dev/null +++ b/applied/dwm-movestack-20211115-a786211.diff @@ -0,0 +1,95 @@ +From 9a4037dc0ef56f91c009317e78e9e3790dafbb58 Mon Sep 17 00:00:00 2001 +From: BrunoCooper17 <BrunoCooper17@outlook.com> +Date: Mon, 15 Nov 2021 14:04:53 -0600 +Subject: [PATCH] MoveStack patch + +This plugin allows you to move clients around in the stack and swap them +with the master. It emulates the behavior off mod+shift+j and mod+shift+k +in Xmonad. movestack(+1) will swap the client with the current focus with +the next client. movestack(-1) will swap the client with the current focus +with the previous client. +--- + config.def.h | 3 +++ + movestack.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 51 insertions(+) + create mode 100644 movestack.c + +diff --git a/config.def.h b/config.def.h +index a2ac963..33efa5b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -60,6 +60,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() + static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; + static const char *termcmd[] = { "st", NULL }; + ++#include "movestack.c" + static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +@@ -71,6 +72,8 @@ static Key keys[] = { + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, ++ { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, ++ { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, +diff --git a/movestack.c b/movestack.c +new file mode 100644 +index 0000000..520f4ae +--- /dev/null ++++ b/movestack.c +@@ -0,0 +1,48 @@ ++void ++movestack(const Arg *arg) { ++ Client *c = NULL, *p = NULL, *pc = NULL, *i; ++ ++ if(arg->i > 0) { ++ /* find the client after selmon->sel */ ++ for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); ++ if(!c) ++ for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); ++ ++ } ++ else { ++ /* find the client before selmon->sel */ ++ for(i = selmon->clients; i != selmon->sel; i = i->next) ++ if(ISVISIBLE(i) && !i->isfloating) ++ c = i; ++ if(!c) ++ for(; i; i = i->next) ++ if(ISVISIBLE(i) && !i->isfloating) ++ c = i; ++ } ++ /* find the client before selmon->sel and c */ ++ for(i = selmon->clients; i && (!p || !pc); i = i->next) { ++ if(i->next == selmon->sel) ++ p = i; ++ if(i->next == c) ++ pc = i; ++ } ++ ++ /* swap c and selmon->sel selmon->clients in the selmon->clients list */ ++ if(c && c != selmon->sel) { ++ Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next; ++ selmon->sel->next = c->next==selmon->sel?c:c->next; ++ c->next = temp; ++ ++ if(p && p != c) ++ p->next = c; ++ if(pc && pc != selmon->sel) ++ pc->next = selmon->sel; ++ ++ if(selmon->sel == selmon->clients) ++ selmon->clients = c; ++ else if(c == selmon->clients) ++ selmon->clients = selmon->sel; ++ ++ arrange(selmon); ++ } ++} +\ No newline at end of file +-- +2.33.1 + diff --git a/applied/dwm-noborder-6.2.diff b/applied/dwm-noborder-6.2.diff new file mode 100644 index 0000000..f381eb8 --- /dev/null +++ b/applied/dwm-noborder-6.2.diff @@ -0,0 +1,30 @@ +From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001 +From: redacted <redacted@example.com> +Date: Tue, 23 Apr 2019 00:39:27 +0100 +Subject: [PATCH] added noborder patch + +--- + dwm.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/dwm.c b/dwm.c +index 4465af1..685eca1 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -1282,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h) + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) ++ || &monocle == c->mon->lt[c->mon->sellt]->arrange) ++ && !c->isfullscreen && !c->isfloating) { ++ c->w = wc.width += c->bw * 2; ++ c->h = wc.height += c->bw * 2; ++ wc.border_width = 0; ++ } + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +-- +2.21.0 + diff --git a/applied/dwm-pertag-20200914-61bb8b2.diff b/applied/dwm-pertag-20200914-61bb8b2.diff new file mode 100644 index 0000000..c8d7fbc --- /dev/null +++ b/applied/dwm-pertag-20200914-61bb8b2.diff @@ -0,0 +1,177 @@ +diff --git a/dwm.c b/dwm.c +index 664c527..ac8e4ec 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -111,6 +111,7 @@ typedef struct { + void (*arrange)(Monitor *); + } Layout; + ++typedef struct Pertag Pertag; + struct Monitor { + char ltsymbol[16]; + float mfact; +@@ -130,6 +131,7 @@ struct Monitor { + Monitor *next; + Window barwin; + const Layout *lt[2]; ++ Pertag *pertag; + }; + + typedef struct { +@@ -272,6 +274,15 @@ static Window root, wmcheckwin; + /* configuration, allows nested code to access above variables */ + #include "config.h" + ++struct Pertag { ++ unsigned int curtag, prevtag; /* current and previous tag */ ++ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ ++ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ ++ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ ++ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ ++ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ ++}; ++ + /* compile-time check if all tags fit into an unsigned int bit array. */ + struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; + +@@ -632,6 +643,7 @@ Monitor * + createmon(void) + { + Monitor *m; ++ unsigned int i; + + m = ecalloc(1, sizeof(Monitor)); + m->tagset[0] = m->tagset[1] = 1; +@@ -642,6 +654,20 @@ createmon(void) + m->lt[0] = &layouts[0]; + m->lt[1] = &layouts[1 % LENGTH(layouts)]; + strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); ++ m->pertag = ecalloc(1, sizeof(Pertag)); ++ m->pertag->curtag = m->pertag->prevtag = 1; ++ ++ for (i = 0; i <= LENGTH(tags); i++) { ++ m->pertag->nmasters[i] = m->nmaster; ++ m->pertag->mfacts[i] = m->mfact; ++ ++ m->pertag->ltidxs[i][0] = m->lt[0]; ++ m->pertag->ltidxs[i][1] = m->lt[1]; ++ m->pertag->sellts[i] = m->sellt; ++ ++ m->pertag->showbars[i] = m->showbar; ++ } ++ + return m; + } + +@@ -967,7 +993,7 @@ grabkeys(void) + void + incnmaster(const Arg *arg) + { +- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); ++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0); + arrange(selmon); + } + +@@ -1502,9 +1528,9 @@ void + setlayout(const Arg *arg) + { + if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) +- selmon->sellt ^= 1; ++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; + if (arg && arg->v) +- selmon->lt[selmon->sellt] = (Layout *)arg->v; ++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + if (selmon->sel) + arrange(selmon); +@@ -1523,7 +1549,7 @@ setmfact(const Arg *arg) + f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; + if (f < 0.05 || f > 0.95) + return; +- selmon->mfact = f; ++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f; + arrange(selmon); + } + +@@ -1702,7 +1728,7 @@ tile(Monitor *m) + void + togglebar(const Arg *arg) + { +- selmon->showbar = !selmon->showbar; ++ selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; + updatebarpos(selmon); + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + arrange(selmon); +@@ -1741,9 +1767,33 @@ void + toggleview(const Arg *arg) + { + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); ++ int i; + + if (newtagset) { + selmon->tagset[selmon->seltags] = newtagset; ++ ++ if (newtagset == ~0) { ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ selmon->pertag->curtag = 0; ++ } ++ ++ /* test if the user did not select the same tag */ ++ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) { ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ for (i = 0; !(newtagset & 1 << i); i++) ; ++ selmon->pertag->curtag = i + 1; ++ } ++ ++ /* apply settings for this view */ ++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; ++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; ++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; ++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; ++ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; ++ ++ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) ++ togglebar(NULL); ++ + focus(NULL); + arrange(selmon); + } +@@ -2038,11 +2088,37 @@ updatewmhints(Client *c) + void + view(const Arg *arg) + { ++ int i; ++ unsigned int tmptag; ++ + if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) + return; + selmon->seltags ^= 1; /* toggle sel tagset */ +- if (arg->ui & TAGMASK) ++ if (arg->ui & TAGMASK) { + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ ++ if (arg->ui == ~0) ++ selmon->pertag->curtag = 0; ++ else { ++ for (i = 0; !(arg->ui & 1 << i); i++) ; ++ selmon->pertag->curtag = i + 1; ++ } ++ } else { ++ tmptag = selmon->pertag->prevtag; ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ selmon->pertag->curtag = tmptag; ++ } ++ ++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; ++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; ++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; ++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; ++ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; ++ ++ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) ++ togglebar(NULL); ++ + focus(NULL); + arrange(selmon); + } diff --git a/applied/dwm-savefloats-20181212-b69c870.diff b/applied/dwm-savefloats-20181212-b69c870.diff new file mode 100644 index 0000000..f5d8ed8 --- /dev/null +++ b/applied/dwm-savefloats-20181212-b69c870.diff @@ -0,0 +1,42 @@ +diff --git i/dwm.c w/dwm.c +index 4465af1..96b0b26 100644 +--- i/dwm.c ++++ w/dwm.c +@@ -88,6 +88,7 @@ struct Client { + char name[256]; + float mina, maxa; + int x, y, w, h; ++ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */ + int oldx, oldy, oldw, oldh; + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; +@@ -1056,6 +1057,10 @@ manage(Window w, XWindowAttributes *wa) + updatewindowtype(c); + updatesizehints(c); + updatewmhints(c); ++ c->sfx = c->x; ++ c->sfy = c->y; ++ c->sfw = c->w; ++ c->sfh = c->h; + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); + grabbuttons(c, 0); + if (!c->isfloating) +@@ -1714,8 +1719,16 @@ togglefloating(const Arg *arg) + return; + selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; + if (selmon->sel->isfloating) +- resize(selmon->sel, selmon->sel->x, selmon->sel->y, +- selmon->sel->w, selmon->sel->h, 0); ++ /* restore last known float dimensions */ ++ resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy, ++ selmon->sel->sfw, selmon->sel->sfh, False); ++ else { ++ /* save last known float dimensions */ ++ selmon->sel->sfx = selmon->sel->x; ++ selmon->sel->sfy = selmon->sel->y; ++ selmon->sel->sfw = selmon->sel->w; ++ selmon->sel->sfh = selmon->sel->h; ++ } + arrange(selmon); + } + diff --git a/applied/dwm-sizehints-isfreesize-6.2.diff b/applied/dwm-sizehints-isfreesize-6.2.diff new file mode 100644 index 0000000..bd9e5da --- /dev/null +++ b/applied/dwm-sizehints-isfreesize-6.2.diff @@ -0,0 +1,103 @@ +From 5d4e92801206d47090236498d35f199e46dd07f6 Mon Sep 17 00:00:00 2001 +From: MLquest8 <miskuzius@gmail.com> +Date: Sat, 20 Jun 2020 15:40:43 +0400 +Subject: [PATCH] sizehints-ruled now with a separate rule "isfreesize" and + cleaner code. + +--- + config.def.h | 8 +++++--- + dwm.c | 16 +++++++++++++--- + 2 files changed, 18 insertions(+), 6 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..0e4a5ea 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -26,9 +26,11 @@ static const Rule rules[] = { + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ +- /* class instance title tags mask isfloating monitor */ +- { "Gimp", NULL, NULL, 0, 1, -1 }, +- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ /* class instance title tags mask isfloating isfreesize monitor */ ++ { "Gimp", NULL, NULL, 0, 1, 1, -1 }, ++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, ++ { "st", NULL, NULL, 0, 0, 0, -1 }, ++ { "St", NULL, NULL, 0, 0, 0, -1 }, /* St with Xresources patch */ + }; + + /* layout(s) */ +diff --git a/dwm.c b/dwm.c +index 9fd0286..73825d1 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -92,7 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, isfloating, isfreesize, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; +@@ -138,6 +138,7 @@ typedef struct { + const char *title; + unsigned int tags; + int isfloating; ++ int isfreesize; + int monitor; + } Rule; + +@@ -287,6 +288,7 @@ applyrules(Client *c) + + /* rule matching */ + c->isfloating = 0; ++ c->isfreesize = 1; + c->tags = 0; + XGetClassHint(dpy, c->win, &ch); + class = ch.res_class ? ch.res_class : broken; +@@ -299,6 +301,7 @@ applyrules(Client *c) + && (!r->instance || strstr(instance, r->instance))) + { + c->isfloating = r->isfloating; ++ c->isfreesize = r->isfreesize; + c->tags |= r->tags; + for (m = mons; m && m->num != r->monitor; m = m->next); + if (m) +@@ -1952,7 +1955,7 @@ updatesizehints(Client *c) + + if (!XGetWMNormalHints(dpy, c->win, &size, &msize)) + /* size is uninitialized, ensure that size.flags aren't used */ +- size.flags = PSize; ++ size.flags = 0; + if (size.flags & PBaseSize) { + c->basew = size.base_width; + c->baseh = size.base_height; +@@ -1984,6 +1987,11 @@ updatesizehints(Client *c) + c->maxa = (float)size.max_aspect.x / size.max_aspect.y; + } else + c->maxa = c->mina = 0.0; ++ if((size.flags & PSize) && c->isfreesize) { ++ c->basew = size.base_width; ++ c->baseh = size.base_height; ++ c->isfloating = 1; ++ } + c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh); + } + +@@ -2012,8 +2020,10 @@ updatewindowtype(Client *c) + + if (state == netatom[NetWMFullscreen]) + setfullscreen(c, 1); +- if (wtype == netatom[NetWMWindowTypeDialog]) ++ if (wtype == netatom[NetWMWindowTypeDialog]) { + c->isfloating = 1; ++ c->isfreesize = 1; ++ } + } + + void +-- +2.26.2 + diff --git a/applied/dwm-switchtotag-6.2.diff b/applied/dwm-switchtotag-6.2.diff new file mode 100644 index 0000000..453f8ef --- /dev/null +++ b/applied/dwm-switchtotag-6.2.diff @@ -0,0 +1,58 @@ +diff -up dwm-6.2-original/config.def.h dwm-6.2-modified/config.def.h +--- dwm-6.2-original/config.def.h 2019-02-02 14:55:28.000000000 +0200 ++++ dwm-6.2-modified/config.def.h 2019-11-18 19:36:22.515566509 +0200 +@@ -26,9 +26,9 @@ static const Rule rules[] = { + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ +- /* class instance title tags mask isfloating monitor */ +- { "Gimp", NULL, NULL, 0, 1, -1 }, +- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ /* class instance title tags mask switchtotag isfloating monitor */ ++ { "Gimp", NULL, NULL, 0, 0, 1, -1 }, ++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, + }; + + /* layout(s) */ +diff -up dwm-6.2-original/dwm.c dwm-6.2-modified/dwm.c +--- dwm-6.2-original/dwm.c 2019-02-02 14:55:28.000000000 +0200 ++++ dwm-6.2-modified/dwm.c 2019-11-18 19:37:18.792187705 +0200 +@@ -92,6 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; ++ unsigned int switchtotag; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; +@@ -137,6 +138,7 @@ typedef struct { + const char *instance; + const char *title; + unsigned int tags; ++ unsigned int switchtotag; + int isfloating; + int monitor; + } Rule; +@@ -302,6 +304,11 @@ applyrules(Client *c) + for (m = mons; m && m->num != r->monitor; m = m->next); + if (m) + c->mon = m; ++ if (r->switchtotag) { ++ Arg a = { .ui = r->tags }; ++ c->switchtotag = selmon->tagset[selmon->seltags]; ++ view(&a); ++ } + } + } + if (ch.res_class) +@@ -1782,6 +1789,10 @@ unmanage(Client *c, int destroyed) + focus(NULL); + updateclientlist(); + arrange(m); ++ if (c->switchtotag) { ++ Arg a = { .ui = c->switchtotag }; ++ view(&a); ++ } + } + + void diff --git a/applied/dwm-tagothermonitor-6.2.diff b/applied/dwm-tagothermonitor-6.2.diff new file mode 100644 index 0000000..fddc994 --- /dev/null +++ b/applied/dwm-tagothermonitor-6.2.diff @@ -0,0 +1,80 @@ +From 9d9ffce06c0ac0903917e19a7e70a78813e12e2f Mon Sep 17 00:00:00 2001 +From: Dennis Witzig <dennis@wtzg.de> +Date: Mon, 1 Jun 2020 23:02:45 +0200 +Subject: [PATCH] Add ability to move a window to specific tag on the next or + previous monitor + +--- + config.def.h | 4 +++- + dwm.c | 33 +++++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..580382e 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -49,7 +49,9 @@ static const Layout layouts[] = { + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ +- { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, ++ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \ ++ { MODKEY|Mod4Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \ ++ { MODKEY|Mod4Mask|ShiftMask, KEY, tagprevmon, {.ui = 1 << TAG} }, + + /* helper for spawning shell commands in the pre dwm-5.0 fashion */ + #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +diff --git a/dwm.c b/dwm.c +index 4465af1..d3ace89 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -208,6 +208,9 @@ static void sigchld(int unused); + static void spawn(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); ++static void tagnextmon(const Arg *arg); ++static void tagprevmon(const Arg *arg); ++static void tagothermon(const Arg *arg, int dir); + static void tile(Monitor *); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); +@@ -1670,6 +1673,36 @@ tagmon(const Arg *arg) + sendmon(selmon->sel, dirtomon(arg->i)); + } + ++void ++tagnextmon(const Arg *arg) ++{ ++ tagothermon(arg, 1); ++} ++ ++void ++tagprevmon(const Arg *arg) ++{ ++ tagothermon(arg, -1); ++} ++ ++void ++tagothermon(const Arg *arg, int dir) ++{ ++ Client *sel; ++ Monitor *newmon; ++ ++ if (!selmon->sel || !mons->next) ++ return; ++ sel = selmon->sel; ++ newmon = dirtomon(dir); ++ sendmon(sel, newmon); ++ if (arg->ui & TAGMASK) { ++ sel->tags = arg->ui & TAGMASK; ++ focus(NULL); ++ arrange(newmon); ++ } ++} ++ + void + tile(Monitor *m) + { +-- +2.26.2 + diff --git a/config.def.h b/config.def.h index a6c11c3..f418015 100644 --- a/config.def.h +++ b/config.def.h @@ -18,6 +18,8 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, + [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } }; /* tagging */ @@ -44,6 +46,15 @@ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ +/* Bartabgroups properties */ +#define BARTAB_BORDERS 1 // 0 = off, 1 = on +#define BARTAB_BOTTOMBORDER 1 // 0 = off, 1 = on +#define BARTAB_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on +#define BARTAB_TAGSPX 5 // # pixels for tag grid boxes +#define BARTAB_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) +static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; +static void (*bartabfloatfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; + static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ @@ -18,6 +18,8 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, + [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } }; /* tagging */ @@ -44,6 +46,15 @@ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ +/* Bartabgroups properties */ +#define BARTAB_BORDERS 1 // 0 = off, 1 = on +#define BARTAB_BOTTOMBORDER 1 // 0 = off, 1 = on +#define BARTAB_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on +#define BARTAB_TAGSPX 5 // # pixels for tag grid boxes +#define BARTAB_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) +static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; +static void (*bartabfloatfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; + static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ @@ -60,7 +60,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeTabActive, SchemeTabInactive }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ @@ -408,6 +408,98 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) } void +bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive) { + if (!c) return; + int i, nclienttags = 0, nviewtags = 0; + + drw_setscheme(drw, scheme[ + m->sel == c ? SchemeSel : (groupactive ? SchemeTabActive: SchemeTabInactive) + ]); + drw_text(drw, x, 0, w, bh, lrpad / 2, c->name, 0); + + // Floating win indicator + if (c->isfloating) drw_rect(drw, x + 2, 2, 5, 5, 0, 0); + + // Optional borders between tabs + if (BARTAB_BORDERS) { + XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBorder].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, 0, 1, bh); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w, 0, 1, bh); + } + + // Optional tags icons + for (i = 0; i < LENGTH(tags); i++) { + if ((m->tagset[m->seltags] >> i) & 1) { nviewtags++; } + if ((c->tags >> i) & 1) { nclienttags++; } + } + if (BARTAB_TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1) { + for (i = 0; i < LENGTH(tags); i++) { + drw_rect(drw, + ( x + w - 2 - ((LENGTH(tags) / BARTAB_TAGSROWS) * BARTAB_TAGSPX) + - (i % (LENGTH(tags)/BARTAB_TAGSROWS)) + ((i % (LENGTH(tags) / BARTAB_TAGSROWS)) * BARTAB_TAGSPX) + ), + ( 2 + ((i / (LENGTH(tags)/BARTAB_TAGSROWS)) * BARTAB_TAGSPX) + - ((i / (LENGTH(tags)/BARTAB_TAGSROWS))) + ), + BARTAB_TAGSPX, BARTAB_TAGSPX, (c->tags >> i) & 1, 0 + ); + } + } +} + +void +battabclick(Monitor *m, Client *c, int passx, int x, int w, int unused) { + if (passx >= x && passx <= x + w) { + focus(c); + restack(selmon); + } +} + +void +bartabcalculate( + Monitor *m, int offx, int sw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int) +) { + Client *c; + int + i, clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, + masteractive = 0, fulllayout = 0, floatlayout = 0, + x, w, tgactive; + + for (i = 0, c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c)) continue; + if (c->isfloating) { clientsnfloating++; continue; } + if (m->sel == c) { masteractive = i < m->nmaster; } + if (i < m->nmaster) { clientsnmaster++; } else { clientsnstack++; } + i++; + } + for (i = 0; i < LENGTH(bartabfloatfns); i++) if (m ->lt[m->sellt]->arrange == bartabfloatfns[i]) { floatlayout = 1; break; } + for (i = 0; i < LENGTH(bartabmonfns); i++) if (m ->lt[m->sellt]->arrange == bartabmonfns[i]) { fulllayout = 1; break; } + for (c = m->clients, i = 0; c; c = c->next) { + if (!ISVISIBLE(c)) continue; + if (clientsnmaster + clientsnstack == 0 || floatlayout) { + x = offx + (((m->mw - offx - sw) / (clientsnmaster + clientsnstack + clientsnfloating)) * i); + w = (m->mw - offx - sw) / (clientsnmaster + clientsnstack + clientsnfloating); + tgactive = 1; + } else if (!c->isfloating && (fulllayout || ((clientsnmaster == 0) ^ (clientsnstack == 0)))) { + x = offx + (((m->mw - offx - sw) / (clientsnmaster + clientsnstack)) * i); + w = (m->mw - offx - sw) / (clientsnmaster + clientsnstack); + tgactive = 1; + } else if (i < m->nmaster && !c->isfloating) { + x = offx + ((((m->mw * m->mfact) - offx) /clientsnmaster) * i); + w = ((m->mw * m->mfact) - offx) / clientsnmaster; + tgactive = masteractive; + } else if (!c->isfloating) { + x = (m->mw * m->mfact) + ((((m->mw * (1 - m->mfact)) - sw) / clientsnstack) * (i - m->nmaster)); + w = ((m->mw * (1 - m->mfact)) - sw) / clientsnstack; + tgactive = !masteractive; + } else continue; + tabfn(m, c, passx, x, w, tgactive); + i++; + } +} + +void arrange(Monitor *m) { if (m) @@ -493,8 +585,8 @@ buttonpress(XEvent *e) click = ClkLtSymbol; else if (ev->x > selmon->ww - (int)TEXTW(stext)) click = ClkStatusText; - else - click = ClkWinTitle; + else // Focus clicked tab bar item + bartabcalculate(selmon, x, TEXTW(stext) - lrpad + 2, ev->x, battabclick); } else if ((c = wintoclient(ev->window))) { if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) focus(c); @@ -799,15 +891,13 @@ drawbar(Monitor *m) drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + // Draw bartabgroups + drw_rect(drw, x, 0, m->ww - tw - x, bh, 1, 1); if ((w = m->ww - tw - x) > bh) { - if (m->sel) { - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); - if (m->sel->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); - } else { - drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); + bartabcalculate(m, x, tw, -1, bartabdraw); + if (BARTAB_BOTTOMBORDER) { + drw_setscheme(drw, scheme[SchemeTabActive]); + drw_rect(drw, 0, bh - 1, m->ww, 1, 1, 0); } } drw_map(drw, m->barwin, 0, 0, m->ww, bh); |