From 02f862f6f7ed1ccc8b4841cc40f954d533606ffd Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 20 Jul 2020 08:20:04 +0200 Subject: [PATCH] Removing top level diff, i.e. [PATCH 1/2], from patches --- README.md | 3 +- dwm/dwm-alpha-systray-6.2.diff | 366 +-------------------------- dwm/dwm-cfacts-dragcfact-6.2.diff | 118 --------- dwm/dwm-cfacts-vanitygaps-6.2.diff | 118 --------- dwm/dwm-pertag-monitorrules-6.2.diff | 197 -------------- 5 files changed, 11 insertions(+), 791 deletions(-) diff --git a/README.md b/README.md index dff4534..24fca04 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,5 @@ This repository contains a selection of patches for suckless projects. Most of these are derived from the flexipatch projects, e.g. [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch), and it should be noted that some of them have cross-patch compatibility built-in using the same preprocessor directives as used in the flexipatch builds. One good example of this is the [dragmfact](https://github.com/bakkeby/patches/blob/master/dwm/dwm-dragmfact-6.2.diff) patch which can involve up to 11 additional patches. Due to the many possible patch combinations I have decided to leave these preprocessor directives in there as a form of guide for integrating this into your own build - the idea being that you manually delete the code that you don't need. -For cases where one patch changes another, e.g. adding additional fields on top of pertag, individual patches should exist as far as feasible. +For cascading patches, e.g. dragcfact on top of cfacts, sub-patches will only contain their relevant change. This is to make it easier to apply multiple sub-patches. +This means that in order to apply the dragcfact patch ([dwm-cfacts-dragcfact-6.2.diff](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-dragcfact-6.2.diff)) you would have to apply the [cfacts](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-6.2.diff) patch first if you do not already have it. \ No newline at end of file diff --git a/dwm/dwm-alpha-systray-6.2.diff b/dwm/dwm-alpha-systray-6.2.diff index 40235ef..3f67297 100644 --- a/dwm/dwm-alpha-systray-6.2.diff +++ b/dwm/dwm-alpha-systray-6.2.diff @@ -1,311 +1,13 @@ -From 986ee6a3ae3dcdd704b69f1dbd954115246021bf Mon Sep 17 00:00:00 2001 -From: bakkeby -Date: Tue, 7 Apr 2020 10:47:07 +0200 -Subject: [PATCH 1/3] Alpha, adds transparency for the status bar. - -Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st. - -Refer to https://dwm.suckless.org/patches/alpha/ - -Authors: - -Eon S. Jeon - esjeon@hyunmu.am -Laslo Hunhold - dev@frign.de (6.1 port) -Thomas Oltmann - thomas.oltmann.hhg@gmail.com (20180613-b69c870 port) ---- - config.def.h | 7 ++++++ - config.mk | 2 +- - drw.c | 26 ++++++++++++----------- - drw.h | 9 +++++--- - dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------ - 5 files changed, 82 insertions(+), 22 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..4f68fe8 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -12,11 +12,18 @@ static const char col_gray2[] = "#444444"; - static const char col_gray3[] = "#bbbbbb"; - static const char col_gray4[] = "#eeeeee"; - static const char col_cyan[] = "#005577"; -+static const unsigned int baralpha = 0xd0; -+static const unsigned int borderalpha = OPAQUE; - static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, - }; -+static const unsigned int alphas[][3] = { -+ /* fg bg border */ -+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, -+ [SchemeSel] = { OPAQUE, baralpha, borderalpha }, -+}; - - /* tagging */ - static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; -diff --git a/config.mk b/config.mk -index 6d36cb7..3cb1518 100644 ---- a/config.mk -+++ b/config.mk -@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2 - - # includes and libs - INCS = -I${X11INC} -I${FREETYPEINC} --LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender - - # flags - CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -diff --git a/drw.c b/drw.c -index 8fd1ca4..c202cb3 100644 ---- a/drw.c -+++ b/drw.c -@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen) - } - - Drw * --drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) -+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) - { - Drw *drw = ecalloc(1, sizeof(Drw)); - -@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h - drw->root = root; - drw->w = w; - drw->h = h; -- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); -- drw->gc = XCreateGC(dpy, root, 0, NULL); -+ drw->visual = visual; -+ drw->depth = depth; -+ drw->cmap = cmap; -+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth); -+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL); - XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); - - return drw; -@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h) - drw->h = h; - if (drw->drawable) - XFreePixmap(drw->dpy, drw->drawable); -- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); -+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); - } - - void -@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font) - } - - void --drw_clr_create(Drw *drw, Clr *dest, const char *clrname) -+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha) - { - if (!drw || !dest || !clrname) - return; - -- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), -- DefaultColormap(drw->dpy, drw->screen), -+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, - clrname, dest)) - die("error, cannot allocate color '%s'", clrname); -+ -+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); - } - - /* Wrapper to create color schemes. The caller has to call free(3) on the - * returned color scheme when done using it. */ - Clr * --drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) -+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount) - { - size_t i; - Clr *ret; -@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) - return NULL; - - for (i = 0; i < clrcount; i++) -- drw_clr_create(drw, &ret[i], clrnames[i]); -+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); - return ret; - } - -@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp - } else { - XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); -- d = XftDrawCreate(drw->dpy, drw->drawable, -- DefaultVisual(drw->dpy, drw->screen), -- DefaultColormap(drw->dpy, drw->screen)); -+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); - x += lpad; - w -= lpad; - } -diff --git a/drw.h b/drw.h -index 4bcd5ad..a56f523 100644 ---- a/drw.h -+++ b/drw.h -@@ -20,6 +20,9 @@ typedef struct { - Display *dpy; - int screen; - Window root; -+ Visual *visual; -+ unsigned int depth; -+ Colormap cmap; - Drawable drawable; - GC gc; - Clr *scheme; -@@ -27,7 +30,7 @@ typedef struct { - } Drw; - - /* Drawable abstraction */ --Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); -+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap); - void drw_resize(Drw *drw, unsigned int w, unsigned int h); - void drw_free(Drw *drw); - -@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text); - void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); - - /* Colorscheme abstraction */ --void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); --Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); -+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha); -+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount); - - /* Cursor abstraction */ - Cur *drw_cur_create(Drw *drw, int shape); -diff --git a/dwm.c b/dwm.c -index 4465af1..20f8309 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -57,6 +57,8 @@ - #define TAGMASK ((1 << LENGTH(tags)) - 1) - #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) - -+#define OPAQUE 0xffU -+ - /* enums */ - enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ - enum { SchemeNorm, SchemeSel }; /* color schemes */ -@@ -232,6 +234,7 @@ static Monitor *wintomon(Window w); - static int xerror(Display *dpy, XErrorEvent *ee); - static int xerrordummy(Display *dpy, XErrorEvent *ee); - static int xerrorstart(Display *dpy, XErrorEvent *ee); -+static void xinitvisual(); - static void zoom(const Arg *arg); - - /* variables */ -@@ -268,6 +271,11 @@ static Drw *drw; - static Monitor *mons, *selmon; - static Window root, wmcheckwin; - -+static int useargb = 0; -+static Visual *visual; -+static int depth; -+static Colormap cmap; -+ - /* configuration, allows nested code to access above variables */ - #include "config.h" - -@@ -1541,7 +1549,8 @@ setup(void) - sw = DisplayWidth(dpy, screen); - sh = DisplayHeight(dpy, screen); - root = RootWindow(dpy, screen); -- drw = drw_create(dpy, screen, root, sw, sh); -+ xinitvisual(); -+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap); - if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) - die("no fonts could be loaded."); - lrpad = drw->fonts->h; -@@ -1569,7 +1578,7 @@ setup(void) - /* init appearance */ - scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); - for (i = 0; i < LENGTH(colors); i++) -- scheme[i] = drw_scm_create(drw, colors[i], 3); -+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3); - /* init bars */ - updatebars(); - updatestatus(); -@@ -1804,16 +1813,18 @@ updatebars(void) - Monitor *m; - XSetWindowAttributes wa = { - .override_redirect = True, -- .background_pixmap = ParentRelative, -+ .background_pixel = 0, -+ .border_pixel = 0, -+ .colormap = cmap, - .event_mask = ButtonPressMask|ExposureMask - }; - XClassHint ch = {"dwm", "dwm"}; - for (m = mons; m; m = m->next) { - if (m->barwin) - continue; -- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), -- CopyFromParent, DefaultVisual(dpy, screen), -- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); -+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth, -+ InputOutput, visual, -+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); - XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); - XMapRaised(dpy, m->barwin); - XSetClassHint(dpy, m->barwin, &ch); -@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee) - return -1; - } - -+void -+xinitvisual() -+{ -+ XVisualInfo *infos; -+ XRenderPictFormat *fmt; -+ int nitems; -+ int i; -+ -+ XVisualInfo tpl = { -+ .screen = screen, -+ .depth = 32, -+ .class = TrueColor -+ }; -+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; -+ -+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); -+ visual = NULL; -+ for(i = 0; i < nitems; i ++) { -+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual); -+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { -+ visual = infos[i].visual; -+ depth = infos[i].depth; -+ cmap = XCreateColormap(dpy, root, visual, AllocNone); -+ useargb = 1; -+ break; -+ } -+ } -+ -+ XFree(infos); -+ -+ if (! visual) { -+ visual = DefaultVisual(dpy, screen); -+ depth = DefaultDepth(dpy, screen); -+ cmap = DefaultColormap(dpy, screen); -+ } -+} -+ - void - zoom(const Arg *arg) - { --- -2.19.1 - - -From f86a0c1616543c9d3ab574786f3b9487638c5c9c Mon Sep 17 00:00:00 2001 +From d3e5ecd08e62ead2c7f29dc031aa529218a32ac8 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 7 Apr 2020 10:53:35 +0200 -Subject: [PATCH 2/3] Adding systray patch +Subject: [PATCH 2/2] Adding systray patch Refer to https://dwm.suckless.org/patches/systray/ --- config.def.h | 4 + - dwm.c | 423 +++++++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 401 insertions(+), 26 deletions(-) + dwm.c | 419 +++++++++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 397 insertions(+), 26 deletions(-) diff --git a/config.def.h b/config.def.h index 4f68fe8..1952613 100644 @@ -323,7 +25,7 @@ index 4f68fe8..1952613 100644 static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; diff --git a/dwm.c b/dwm.c -index 20f8309..d155124 100644 +index 20f8309..8cfbb1a 100644 --- a/dwm.c +++ b/dwm.c @@ -59,12 +59,30 @@ @@ -887,7 +589,7 @@ index 20f8309..d155124 100644 XMapRaised(dpy, m->barwin); XSetClassHint(dpy, m->barwin, &ch); } -@@ -2001,6 +2227,141 @@ updatestatus(void) +@@ -2001,6 +2227,137 @@ updatestatus(void) if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) strcpy(stext, "dwm-"VERSION); drawbar(selmon); @@ -918,7 +620,7 @@ index 20f8309..d155124 100644 + + wa.override_redirect = True; + wa.event_mask = ButtonPressMask|ExposureMask; -+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel & 0x00ffffffU; ++ wa.background_pixel = 0; + wa.border_pixel = 0; + wa.colormap = cmap; + systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth, @@ -947,8 +649,7 @@ index 20f8309..d155124 100644 + + drw_setscheme(drw, scheme[SchemeNorm]); + for (w = 0, i = systray->icons; i; i = i->next) { -+ /* make sure the background color stays the same */ -+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; ++ wa.background_pixel = 0; + XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa); + XMapRaised(dpy, i->win); + w += systrayspacing; @@ -969,9 +670,6 @@ index 20f8309..d155124 100644 + XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc); + XMapWindow(dpy, systray->win); + XMapSubwindows(dpy, systray->win); -+ /* redraw background */ -+ XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel); -+ XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); + XSync(dpy, False); +} + @@ -1029,7 +727,7 @@ index 20f8309..d155124 100644 } void -@@ -2085,6 +2446,16 @@ wintomon(Window w) +@@ -2085,6 +2442,16 @@ wintomon(Window w) return selmon; } @@ -1049,49 +747,3 @@ index 20f8309..d155124 100644 -- 2.19.1 - -From 0d7c3a31d974b03f1d93a4c87a0a819903e168df Mon Sep 17 00:00:00 2001 -From: bakkeby -Date: Fri, 17 Jul 2020 21:41:23 +0200 -Subject: [PATCH 3/3] f - ---- - dwm.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/dwm.c b/dwm.c -index d155124..8cfbb1a 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -2254,7 +2254,7 @@ updatesystray(void) - - wa.override_redirect = True; - wa.event_mask = ButtonPressMask|ExposureMask; -- wa.background_pixel = scheme[SchemeNorm][ColBg].pixel & 0x00ffffffU; -+ wa.background_pixel = 0; - wa.border_pixel = 0; - wa.colormap = cmap; - systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth, -@@ -2283,8 +2283,7 @@ updatesystray(void) - - drw_setscheme(drw, scheme[SchemeNorm]); - for (w = 0, i = systray->icons; i; i = i->next) { -- /* make sure the background color stays the same */ -- wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; -+ wa.background_pixel = 0; - XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa); - XMapRaised(dpy, i->win); - w += systrayspacing; -@@ -2305,9 +2304,6 @@ updatesystray(void) - XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc); - XMapWindow(dpy, systray->win); - XMapSubwindows(dpy, systray->win); -- /* redraw background */ -- XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel); -- XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); - XSync(dpy, False); - } - --- -2.19.1 - diff --git a/dwm/dwm-cfacts-dragcfact-6.2.diff b/dwm/dwm-cfacts-dragcfact-6.2.diff index d04da11..63995d2 100644 --- a/dwm/dwm-cfacts-dragcfact-6.2.diff +++ b/dwm/dwm-cfacts-dragcfact-6.2.diff @@ -1,121 +1,3 @@ -From 1f9992ae1a745a86294a555051ea17ba4ef5ce5f Mon Sep 17 00:00:00 2001 -From: bakkeby -Date: Mon, 6 Apr 2020 12:04:55 +0200 -Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign - different weights to clients in their respective stack in tiled layout. - -Refer to https://dwm.suckless.org/patches/cfacts/ ---- - config.def.h | 3 +++ - dwm.c | 35 ++++++++++++++++++++++++++++++++--- - 2 files changed, 35 insertions(+), 3 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..83910c1 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -70,6 +70,9 @@ 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_h, setcfact, {.f = +0.25} }, -+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, -+ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, -diff --git a/dwm.c b/dwm.c -index 4465af1..5592c57 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -87,6 +87,7 @@ typedef struct Client Client; - struct Client { - char name[256]; - float mina, maxa; -+ float cfact; - int x, y, w, h; - int oldx, oldy, oldw, oldh; - int basew, baseh, incw, inch, maxw, maxh, minw, minh; -@@ -200,6 +201,7 @@ static void setclientstate(Client *c, long state); - static void setfocus(Client *c); - static void setfullscreen(Client *c, int fullscreen); - static void setlayout(const Arg *arg); -+static void setcfact(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); - static void seturgent(Client *c, int urg); -@@ -1029,6 +1031,7 @@ manage(Window w, XWindowAttributes *wa) - c->w = c->oldw = wa->width; - c->h = c->oldh = wa->height; - c->oldbw = wa->border_width; -+ c->cfact = 1.0; - - updatetitle(c); - if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { -@@ -1511,6 +1514,24 @@ setlayout(const Arg *arg) - drawbar(selmon); - } - -+void -+setcfact(const Arg *arg) { -+ float f; -+ Client *c; -+ -+ c = selmon->sel; -+ -+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange) -+ return; -+ f = arg->f + c->cfact; -+ if(arg->f == 0.0) -+ f = 1.0; -+ else if(f < 0.25 || f > 4.0) -+ return; -+ c->cfact = f; -+ arrange(selmon); -+} -+ - /* arg > 1.0 will set mfact absolutely */ - void - setmfact(const Arg *arg) -@@ -1674,9 +1695,15 @@ void - tile(Monitor *m) - { - unsigned int i, n, h, mw, my, ty; -+ float mfacts = 0, sfacts = 0; - Client *c; - -- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { -+ if (n < m->nmaster) -+ mfacts += c->cfact; -+ else -+ sfacts += c->cfact; -+ } - if (n == 0) - return; - -@@ -1686,13 +1713,15 @@ tile(Monitor *m) - 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); -+ h = (m->wh - my) * (c->cfact / mfacts); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - my += HEIGHT(c); -+ mfacts -= c->cfact; - } else { -- h = (m->wh - ty) / (n - i); -+ 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); - ty += HEIGHT(c); -+ sfacts -= c->cfact; - } - } - --- -2.19.1 - - From ee8e7b96d6f36f244d68753c2e795a29a7118913 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 6 Apr 2020 12:16:26 +0200 diff --git a/dwm/dwm-cfacts-vanitygaps-6.2.diff b/dwm/dwm-cfacts-vanitygaps-6.2.diff index ce694f9..3fee900 100644 --- a/dwm/dwm-cfacts-vanitygaps-6.2.diff +++ b/dwm/dwm-cfacts-vanitygaps-6.2.diff @@ -1,121 +1,3 @@ -From 1f9992ae1a745a86294a555051ea17ba4ef5ce5f Mon Sep 17 00:00:00 2001 -From: bakkeby -Date: Mon, 6 Apr 2020 12:04:55 +0200 -Subject: [PATCH 1/2] Adding cfacts patch which provides the ability to assign - different weights to clients in their respective stack in tiled layout. - -Refer to https://dwm.suckless.org/patches/cfacts/ ---- - config.def.h | 3 +++ - dwm.c | 35 ++++++++++++++++++++++++++++++++--- - 2 files changed, 35 insertions(+), 3 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..83910c1 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -70,6 +70,9 @@ 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_h, setcfact, {.f = +0.25} }, -+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, -+ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, -diff --git a/dwm.c b/dwm.c -index 4465af1..5592c57 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -87,6 +87,7 @@ typedef struct Client Client; - struct Client { - char name[256]; - float mina, maxa; -+ float cfact; - int x, y, w, h; - int oldx, oldy, oldw, oldh; - int basew, baseh, incw, inch, maxw, maxh, minw, minh; -@@ -200,6 +201,7 @@ static void setclientstate(Client *c, long state); - static void setfocus(Client *c); - static void setfullscreen(Client *c, int fullscreen); - static void setlayout(const Arg *arg); -+static void setcfact(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); - static void seturgent(Client *c, int urg); -@@ -1029,6 +1031,7 @@ manage(Window w, XWindowAttributes *wa) - c->w = c->oldw = wa->width; - c->h = c->oldh = wa->height; - c->oldbw = wa->border_width; -+ c->cfact = 1.0; - - updatetitle(c); - if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { -@@ -1511,6 +1514,24 @@ setlayout(const Arg *arg) - drawbar(selmon); - } - -+void -+setcfact(const Arg *arg) { -+ float f; -+ Client *c; -+ -+ c = selmon->sel; -+ -+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange) -+ return; -+ f = arg->f + c->cfact; -+ if(arg->f == 0.0) -+ f = 1.0; -+ else if(f < 0.25 || f > 4.0) -+ return; -+ c->cfact = f; -+ arrange(selmon); -+} -+ - /* arg > 1.0 will set mfact absolutely */ - void - setmfact(const Arg *arg) -@@ -1674,9 +1695,15 @@ void - tile(Monitor *m) - { - unsigned int i, n, h, mw, my, ty; -+ float mfacts = 0, sfacts = 0; - Client *c; - -- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { -+ if (n < m->nmaster) -+ mfacts += c->cfact; -+ else -+ sfacts += c->cfact; -+ } - if (n == 0) - return; - -@@ -1686,13 +1713,15 @@ tile(Monitor *m) - 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); -+ h = (m->wh - my) * (c->cfact / mfacts); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - my += HEIGHT(c); -+ mfacts -= c->cfact; - } else { -- h = (m->wh - ty) / (n - i); -+ 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); - ty += HEIGHT(c); -+ sfacts -= c->cfact; - } - } - --- -2.19.1 - - From 051e4de72079bb0b8e50d2faa61b9a0ef36434b5 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 8 May 2020 16:51:00 +0200 diff --git a/dwm/dwm-pertag-monitorrules-6.2.diff b/dwm/dwm-pertag-monitorrules-6.2.diff index cceb064..293b55c 100644 --- a/dwm/dwm-pertag-monitorrules-6.2.diff +++ b/dwm/dwm-pertag-monitorrules-6.2.diff @@ -1,200 +1,3 @@ -From fdc70c7b54add4c668fa3ae7458e4c5f5e1bd854 Mon Sep 17 00:00:00 2001 -From: bakkeby -Date: Tue, 7 Apr 2020 12:34:15 +0200 -Subject: [PATCH 1/2] pertag patch, keeps layout, mwfact, barpos and nmaster - per tag - -Refer to https://dwm.suckless.org/patches/pertag/ ---- - dwm.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 86 insertions(+), 7 deletions(-) - -diff --git a/dwm.c b/dwm.c -index 4465af1..4578b1c 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 { -@@ -271,6 +273,16 @@ 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 */ -+ Bool showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ -+ Client *prevzooms[LENGTH(tags) + 1]; /* store zoom information */ -+}; -+ - /* compile-time check if all tags fit into an unsigned int bit array. */ - struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; - -@@ -631,6 +643,7 @@ Monitor * - createmon(void) - { - Monitor *m; -+ int i; - - m = ecalloc(1, sizeof(Monitor)); - m->tagset[0] = m->tagset[1] = 1; -@@ -641,6 +654,27 @@ createmon(void) - m->lt[0] = &layouts[0]; - m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -+ if (!(m->pertag = (Pertag *)calloc(1, sizeof(Pertag)))) -+ die("fatal: could not malloc() %u bytes\n", sizeof(Pertag)); -+ m->pertag->curtag = m->pertag->prevtag = 1; -+ for(i=0; i <= LENGTH(tags); i++) { -+ /* init nmaster */ -+ m->pertag->nmasters[i] = m->nmaster; -+ -+ /* init mfacts */ -+ m->pertag->mfacts[i] = m->mfact; -+ -+ /* init layouts */ -+ m->pertag->ltidxs[i][0] = m->lt[0]; -+ m->pertag->ltidxs[i][1] = m->lt[1]; -+ m->pertag->sellts[i] = m->sellt; -+ -+ /* init showbar */ -+ m->pertag->showbars[i] = m->showbar; -+ -+ /* swap focus and zoomswap*/ -+ m->pertag->prevzooms[i] = NULL; -+ } - return m; - } - -@@ -966,7 +1000,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); - } - -@@ -1500,10 +1534,13 @@ setfullscreen(Client *c, int fullscreen) - void - setlayout(const Arg *arg) - { -- if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) -- selmon->sellt ^= 1; -+ if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) { -+ selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; -+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; -+ } - if (arg && arg->v) -- selmon->lt[selmon->sellt] = (Layout *)arg->v; -+ selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; -+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; - strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); - if (selmon->sel) - arrange(selmon); -@@ -1522,7 +1559,7 @@ setmfact(const Arg *arg) - f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; - if (f < 0.1 || f > 0.9) - return; -- selmon->mfact = f; -+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f; - arrange(selmon); - } - -@@ -1699,7 +1736,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); -@@ -1738,9 +1775,29 @@ void - toggleview(const Arg *arg) - { - unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); -+ int i; - - if (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; -+ } - selmon->tagset[selmon->seltags] = newtagset; -+ -+ /* 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); - } -@@ -2035,11 +2092,33 @@ 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->pertag->prevtag = selmon->pertag->curtag; - selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; -+ 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); - } --- -2.19.1 - - From d9754b776789858914525dc457a84f8bc1b5f640 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 26 Apr 2020 11:35:53 +0200