From 5b8cfb233a4d63cd0c35b7b4a0873da97e25ecce Mon Sep 17 00:00:00 2001 From: c Date: Tue, 5 Dec 2023 15:20:27 -0500 Subject: More patches. --- README | 7 +++++-- config.h | 15 +++++++++------ dwm | Bin 68616 -> 68584 bytes dwm.c | 35 +++++++++++++++++++++++------------ dwm2.c | 44 +++++++++++++++++++++++++++++++------------- 5 files changed, 68 insertions(+), 33 deletions(-) diff --git a/README b/README index 69e0e73..63a4097 100644 --- a/README +++ b/README @@ -6,11 +6,14 @@ This build of dwm has the following patches applied: 1. Pango: dwm.suckless.org/patches/pango/ 2. Actualfullscreen: dwm.suckless.org/patches/actualfullscreen/ 3. Barpadding: dwm.suckless.org/patches/barpadding/ - 4. Fullgaps: http://dwm.suckless.org/patches/fullgaps/ + 4. Fullgaps: dwm.suckless.org/patches/fullgaps/ With an extra patch for resetting gaps. - 5. Movestack: http://dwm.suckless.org/patches/movestack + 5. Movestack: dwm.suckless.org/patches/movestack 6. Xresources: dwm.suckless.org/patches/xresources 7. Hide Vacant Tags: dwm.suckless.org/patches/hide_vacant_tags/ + 8. Resizecorners: dwm.suckless.org/patches/resizecorners + +Many manual changes have also been made. dwm - dynamic window manager ============================ diff --git a/config.h b/config.h index a0d3703..3ca4e38 100644 --- a/config.h +++ b/config.h @@ -79,15 +79,18 @@ static const Rule rules[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* Commands. */ + +#define SCRIPTS "/home/c/.local/bin/" + static char dmenumon[2] = "0"; /* Component of dmenucmd, manipulated in spawn(). */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; -static const char *termcmd[] = { "$SCRIPTS/launchers/term.sh", NULL }; -static const char *webcmd[] = { "$SCRIPTS/launchers/web.sh", NULL }; -static const char *passcmd[] = { "/sbin/passmenu", NULL }; -static const char *bmkscmd[] = { "$SCRIPTS/bmks", NULL }; -static const char *bmkaddcmd[]= { "$SCRIPTS/bmks", "dadd", NULL }; +static const char *termcmd[] = { SCRIPTS "launchers/term.sh", NULL }; +static const char *webcmd[] = { SCRIPTS "launchers/web.sh", NULL }; +static const char *passcmd[] = { SCRIPTS "/sbin/passmenu", NULL }; +static const char *bmkscmd[] = { SCRIPTS "bmks", NULL }; +static const char *bmkaddcmd[]= { SCRIPTS "bmks", "dadd", NULL }; -static const char *papercmd[] = { "$SCRIPTS/wallpaper.sh", NULL }; +static const char *papercmd[] = { SCRIPTS "wallpaper.sh", NULL }; #include "movestack.c" diff --git a/dwm b/dwm index 6a6da61..49a5544 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index a5e3c0c..3a753e6 100644 --- a/dwm.c +++ b/dwm.c @@ -1331,9 +1331,14 @@ void resizemouse(const Arg *arg) { int ocx, ocy, nw, nh; + int ocx2, ocy2, nx, ny; Client *c; Monitor *m; XEvent ev; + int horizcorner, vertcorner; + int di; + unsigned int dui; + Window dummy; Time lasttime = 0; if (!(c = selmon->sel)) @@ -1343,10 +1348,15 @@ resizemouse(const Arg *arg) restack(selmon); ocx = c->x; ocy = c->y; + ocx2 = c->x + c->w; + ocy2 = c->y + c->h; if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) return; - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) + return; + horizcorner = nx < c->w / 2; + vertcorner = ny < c->h / 2; do { XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); switch(ev.type) { @@ -1360,21 +1370,22 @@ resizemouse(const Arg *arg) continue; lasttime = ev.xmotion.time; - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); - if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww - && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) - { - if (!c->isfloating && selmon->lt[selmon->sellt]->arrange - && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) - togglefloating(NULL); - } + nx = horizcorner ? ev.xmotion.x : c->x; + ny = vertcorner ? ev.xmotion.y : c->y; + nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); + nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); + + if (!(c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange)) { + selmon->mfact = (double) (ev.xmotion.x - selmon->mx) / (double) selmon->ww; + arrange(selmon); + } + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) - resize(c, c->x, c->y, nw, nh, 1); + resize(c, nx, ny, nw, nh, 1); break; } } while (ev.type != ButtonRelease); - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + XUngrabPointer(dpy, CurrentTime); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { diff --git a/dwm2.c b/dwm2.c index 5275d8e..2c5275b 100644 --- a/dwm2.c +++ b/dwm2.c @@ -457,9 +457,15 @@ buttonpress(XEvent *e) } if (ev->window == selmon->barwin) { i = x = 0; - do + unsigned int occ = 0; + for(c = m->clients; c; c=c->next) + occ |= c->tags; + do { + /* Do not reserve space for vacant tags */ + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) + continue; x += TEXTW(tags[i]); - while (ev->x >= x && ++i < LENGTH(tags)); + } while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; @@ -746,13 +752,12 @@ drawbar(Monitor *m) } x = 0; for (i = 0; i < LENGTH(tags); i++) { + /* Do not draw vacant tags */ + if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) + continue; w = TEXTW(tags[i]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i, False); - if (occ & 1 << i) - drw_rect(drw, x + boxs, boxs, boxw, boxw, - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - urg & 1 << i); x += w; } w = TEXTW(m->ltsymbol); @@ -1325,10 +1330,15 @@ resizeclient(Client *c, int x, int y, int w, int h) void resizemouse(const Arg *arg) { - int ocx, ocy, nw, nh; + int x, y, ocw, och, nw, nh; + int ocx2, ocy2, nx, ny; Client *c; Monitor *m; XEvent ev; + int horizcorner, vertcorner; + int di; + unsigned int dui; + Window dummy; Time lasttime = 0; if (!(c = selmon->sel)) @@ -1336,12 +1346,18 @@ resizemouse(const Arg *arg) if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ return; restack(selmon); - ocx = c->x; - ocy = c->y; + ocw = c->x; + och = c->y; + ocx2 = c->x + c->w; + ocy2 = c->y + c->h; if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) return; - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) + return; + horizcorner = nx < c->w / 2; + vertcorner = ny < c->h / 2; + if (!getrootptr(&x, &y)) { return; } do { XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); switch(ev.type) { @@ -1355,8 +1371,11 @@ resizemouse(const Arg *arg) continue; lasttime = ev.xmotion.time; - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); + nx = horizcorner ? ev.xmotion.x : c->x; + ny = vertcorner ? ev.xmotion.y : c->y; + nw = MAX(ocw + nx, 1); + nh = MAX(och + ny, 1); + if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) { @@ -1369,7 +1388,6 @@ resizemouse(const Arg *arg) break; } } while (ev.type != ButtonRelease); - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); XUngrabPointer(dpy, CurrentTime); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { -- cgit v1.2.3