diff options
| author | yuzu-eva <stevenhu@web.de> | 2023-06-24 01:49:04 +0200 |
|---|---|---|
| committer | yuzu-eva <stevenhu@web.de> | 2023-06-24 01:49:04 +0200 |
| commit | d9ebcd14d1ee1891ce25eeb18fdbf8948c84365e (patch) | |
| tree | cc525a3e453a47a743be2ad2ae074d0dede01c33 | |
| parent | e9fc3b3166c40d3876e2c304cfdf267973982dd6 (diff) | |
removed some unused patches
| -rw-r--r-- | config.h | 42 | ||||
| -rw-r--r-- | config.mk | 5 | ||||
| -rw-r--r-- | drw.c | 14 | ||||
| -rw-r--r-- | drw.o | bin | 11184 -> 11104 bytes | |||
| -rwxr-xr-x | dwm | bin | 75680 -> 74800 bytes | |||
| -rw-r--r-- | dwm.c | 166 | ||||
| -rw-r--r-- | dwm.o | bin | 65600 -> 62832 bytes | |||
| -rw-r--r-- | patch/dwm-fibonacci-20200418-c82db69.diff | 114 | ||||
| -rw-r--r-- | patch/dwm-setborderpx-6.2.diff | 90 | ||||
| -rw-r--r-- | patch/dwm-vanitygaps-20200610-f09418b.diff | 206 | ||||
| -rw-r--r-- | vanitygaps.c | 297 |
11 files changed, 110 insertions, 824 deletions
@@ -4,17 +4,13 @@ #define TERMCLASS "st-256color" /* appearance */ -static const unsigned int borderpx = 0; /* border pixel of windows; 3 is min pixels needed for smooth rounded corners */ +static const unsigned int borderpx = 0; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int gappih = 0; /* horiz inner gap between windows */ -static const unsigned int gappiv = 0; /* vert inner gap between windows */ -static const unsigned int gappoh = 0; /* horiz outer gap between windows and screen edge */ -static const unsigned int gappov = 0; /* vert outer gap between windows and screen edge */ -static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ +static const unsigned int minwsz = 20; /* Minimal height of a client for smfact */ static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ 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 int focusonwheel = 0; static const char *fonts[] = { "Hack Nerd Font:size=11", "JoyPixels:pixelsize:11:antialias=true:autohint=true"}; static const char dmenufont[] = "Hack Nerd Font:size=11"; static const char col_gray1[] = "#222222"; @@ -29,35 +25,33 @@ static const char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1", "2", "3", "4"}; +static const char *tags[] = { "1", "2", "3", "4" }; static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating isterminal noswallow monitor */ + /* class instance title tags mask isfloating isterminal noswallow monitor */ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, - { "nyxt", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, + { "nyxt", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, { TERMCLASS, NULL, NULL, 0, 0, 1, 0, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ }; /* layout(s) */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const float smfact = 0.00; /* factor of tiled chlients [0.00..0.95] */ 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 */ -#include "vanitygaps.c" static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, - { "[@]", spiral }, - { "[\\]", dwindle }, }; /* key definitions */ @@ -79,6 +73,7 @@ static const char *upvol[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_S static const char *downvol[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL }; static const char *mutevol[] = { "/usr/bin/wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL }; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, @@ -88,27 +83,16 @@ static Key keys[] = { { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, - { MODKEY, XK_minus, incrgaps, {.i = +1 } }, - { MODKEY, XK_equal, incrgaps, {.i = -1 } }, - { MODKEY|ShiftMask, XK_minus, incrogaps, {.i = +1 } }, - { MODKEY|ShiftMask, XK_equal, incrogaps, {.i = -1 } }, - { MODKEY|ControlMask, XK_minus, incrigaps, {.i = +1 } }, - { MODKEY|ControlMask, XK_equal, incrigaps, {.i = -1 } }, - { MODKEY, XK_bracketleft, setborderpx, {.i = +1 } }, - { MODKEY, XK_bracketright, setborderpx, {.i = -1 } }, - { MODKEY, XK_backslash, setborderpx, {.i = 0 } }, - { MODKEY, XK_0, togglegaps, {0} }, - { MODKEY|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} }, + { MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|ShiftMask, XK_j, setsmfact, {.f = -0.05} }, + { MODKEY|ShiftMask, XK_k, setsmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_r, setlayout, {.v = &layouts[3]} }, - { MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, @@ -138,7 +122,7 @@ static Key keys[] = { /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ -static Button buttons[] = { +static const Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, @@ -1,5 +1,5 @@ # dwm version -VERSION = 6.3 +VERSION = 6.4 # Customize below to fit your system @@ -17,7 +17,6 @@ XINERAMAFLAGS = -DXINERAMA # freetype FREETYPELIBS = -lfontconfig -lXft FREETYPEINC = /usr/include/freetype2 -#KVMLIB = -lkvm # OpenBSD (uncomment) #FREETYPEINC = ${X11INC}/freetype2 #MANPREFIX = ${PREFIX}/man @@ -27,7 +26,7 @@ INCS = -I${X11INC} -I${FREETYPEINC} LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB} # flags -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} @@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) die("no font specified."); } - /* Do not allow using color fonts. This is a workaround for a BadLength - * error from Xft with color glyphs. Modelled on the Xterm workaround. See - * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 - * https://lists.suckless.org/dev/1701/30932.html - * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 - * and lots more all over the internet. */ - - /* FcBool iscol; */ - /* if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { */ - /* XftFontClose(drw->dpy, xfont); */ - /* return NULL; */ - /* } */ - font = ecalloc(1, sizeof(Fnt)); font->xfont = xfont; font->pattern = pattern; @@ -368,7 +355,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp fcpattern = FcPatternDuplicate(drw->fonts->pattern); FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); - FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); FcDefaultSubstitute(fcpattern); Binary files differBinary files differ@@ -78,6 +78,7 @@ typedef union { int i; unsigned int ui; float f; + float sf; const void *v; } Arg; @@ -123,17 +124,12 @@ typedef struct { struct Monitor { char ltsymbol[16]; float mfact; + float smfact; int nmaster; int num; int by; /* bar geometry */ int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ - int gappih; /* horizontal gap between windows */ - int gappiv; /* vertical gap between windows */ - int gappoh; /* horizontal outer gaps */ - int gappov; /* vertical outer gaps */ - int gappx; /* gaps between windows */ - unsigned int borderpx; unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; @@ -212,19 +208,19 @@ static void run(void); static void scan(void); static int sendevent(Client *c, Atom proto); static void sendmon(Client *c, Monitor *m); -static void setborderpx(const Arg *arg); 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 setmfact(const Arg *arg); +static void setsmfact(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); -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 tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -710,14 +706,10 @@ createmon(void) m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = 1; m->mfact = mfact; + m->smfact = smfact; m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; - m->borderpx = borderpx; - m->gappih = gappih; - m->gappiv = gappiv; - m->gappoh = gappoh; - m->gappov = gappov; m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); @@ -788,7 +780,7 @@ drawbar(Monitor *m) return; /* draw status first so it can be overdrawn by tags later */ - if (m == selmon || 1) { /* status is only drawn on all monitors */ + if (m == selmon || 1) { /* status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeNorm]); tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); @@ -1015,16 +1007,26 @@ grabkeys(void) { updatenumlockmask(); { - unsigned int i, j; + unsigned int i, j, k; unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; - KeyCode code; + int start, end, skip; + KeySym *syms; XUngrabKey(dpy, AnyKey, AnyModifier, root); - for (i = 0; i < LENGTH(keys); i++) - if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) - for (j = 0; j < LENGTH(modifiers); j++) - XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, - True, GrabModeAsync, GrabModeAsync); + XDisplayKeycodes(dpy, &start, &end); + syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip); + if (!syms) + return; + for (k = start; k <= end; k++) + for (i = 0; i < LENGTH(keys); i++) + /* skip modifier codes, we do that ourselves */ + if (keys[i].keysym == syms[(k - start) * skip]) + for (j = 0; j < LENGTH(modifiers); j++) + XGrabKey(dpy, k, + keys[i].mod | modifiers[j], + root, True, + GrabModeAsync, GrabModeAsync); + XFree(syms); } } @@ -1112,7 +1114,7 @@ manage(Window w, XWindowAttributes *wa) c->y = c->mon->wy + c->mon->wh - HEIGHT(c); c->x = MAX(c->x, c->mon->wx); c->y = MAX(c->y, c->mon->wy); - c->bw = c->mon->borderpx; + c->bw = borderpx; wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); @@ -1472,40 +1474,6 @@ sendmon(Client *c, Monitor *m) } void -setborderpx(const Arg *arg) -{ - Client *c; - int prev_borderpx = selmon->borderpx; - - if (arg->i == 0) - selmon->borderpx = borderpx; - else if (selmon->borderpx + arg->i < 0) - selmon->borderpx = 0; - else - selmon->borderpx += arg->i; - - for (c = selmon->clients; c; c = c->next) - { - if (c->bw + arg->i < 0) - c->bw = selmon->borderpx = 0; - else - c->bw = selmon->borderpx; - if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) - { - if (arg->i != 0 && prev_borderpx + arg->i >= 0) - resize(c, c->x, c->y, c->w-(arg->i*2), c->h-(arg->i*2), 0); - else if (arg->i != 0) - resizeclient(c, c->x, c->y, c->w, c->h); - else if (prev_borderpx > borderpx) - resize(c, c->x, c->y, c->w + 2*(prev_borderpx - borderpx), c->h + 2*(prev_borderpx - borderpx), 0); - else if (prev_borderpx < borderpx) - resize(c, c->x, c->y, c->w-2*(borderpx - prev_borderpx), c->h-2*(borderpx - prev_borderpx), 0); - } - } - arrange(selmon); -} - -void setclientstate(Client *c, long state) { long data[] = { state, None }; @@ -1609,14 +1577,34 @@ setmfact(const Arg *arg) } void +setsmfact(const Arg *arg) { + float sf; + + if(!arg || !selmon->lt[selmon->sellt]->arrange) + return; + sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0; + if(sf < 0 || sf > 0.9) + return; + selmon->smfact = sf; + arrange(selmon); +} + +void setup(void) { int i; XSetWindowAttributes wa; Atom utf8string; + struct sigaction sa; - /* clean up any zombies immediately */ - sigchld(0); + /* do not transform children into zombies when they terminate */ + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT | SA_RESTART; + sa.sa_handler = SIG_IGN; + sigaction(SIGCHLD, &sa, NULL); + + /* clean up any zombies (inherited from .xinitrc etc) immediately */ + while (waitpid(-1, NULL, WNOHANG) > 0); /* init screen */ screen = DefaultScreen(dpy); @@ -1710,22 +1698,22 @@ showhide(Client *c) } void -sigchld(int unused) -{ - if (signal(SIGCHLD, sigchld) == SIG_ERR) - die("can't install SIGCHLD handler:"); - while (0 < waitpid(-1, NULL, WNOHANG)); -} - -void spawn(const Arg *arg) { + struct sigaction sa; + if (arg->v == dmenucmd) dmenumon[0] = '0' + selmon->num; if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); setsid(); + + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigaction(SIGCHLD, &sa, NULL); + execvp(((char **)arg->v)[0], (char **)arg->v); die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]); } @@ -1750,6 +1738,47 @@ tagmon(const Arg *arg) } void +tile(Monitor *m) +{ + unsigned int i, n, h, smh, mw, my, ty; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + + 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++) + 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); + } else { + smh = m->mh * m->smfact; + if(!(nexttiled(c->next))) + h = (m->wh - ty) / (n - i); + else + h = (m->wh - smh - ty) / (n - i); + if(h < minwsz) { + c->isfloating = True; + XRaiseWindow(dpy, c->win); + resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False); + ty -= HEIGHT(c); + } + else + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False); + if(!(nexttiled(c->next))) + ty += HEIGHT(c) + smh; + else + ty += HEIGHT(c); + } +} + +void togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; @@ -2284,11 +2313,6 @@ wintomon(Window w) int xerror(Display *dpy, XErrorEvent *ee) { - /* int opcode, event, error; */ - /* if (XQueryExtension(dpy, "RENDER", &opcode, &event, &error) */ - /* || (ee->request_code == opcode && ee->error_code == BadLength)) */ - /* return 0; */ - if (ee->error_code == BadWindow || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) Binary files differdiff --git a/patch/dwm-fibonacci-20200418-c82db69.diff b/patch/dwm-fibonacci-20200418-c82db69.diff deleted file mode 100644 index 81bba7a..0000000 --- a/patch/dwm-fibonacci-20200418-c82db69.diff +++ /dev/null @@ -1,114 +0,0 @@ -From ec9f55b6005cfa3b025b3d700c61af3ce539d057 Mon Sep 17 00:00:00 2001 -From: Niki Yoshiuchi <nyoshiuchi@gmail.com> -Date: Sat, 18 Apr 2020 09:55:26 -0700 -Subject: [PATCH] Adding the fibonacci layout patch - ---- - config.def.h | 5 ++++ - fibonacci.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 71 insertions(+) - create mode 100644 fibonacci.c - -diff --git a/config.def.h b/config.def.h -index 1c0b587..5708487 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -36,11 +36,14 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] - static const int nmaster = 1; /* number of clients in master area */ - static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ - -+#include "fibonacci.c" - static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -+ { "[@]", spiral }, -+ { "[\\]", dwindle }, - }; - - /* key definitions */ -@@ -76,6 +79,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_r, setlayout, {.v = &layouts[3]} }, -+ { MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, -diff --git a/fibonacci.c b/fibonacci.c -new file mode 100644 -index 0000000..fce0a57 ---- /dev/null -+++ b/fibonacci.c -@@ -0,0 +1,66 @@ -+void -+fibonacci(Monitor *mon, int s) { -+ unsigned int i, n, nx, ny, nw, nh; -+ Client *c; -+ -+ for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++); -+ if(n == 0) -+ return; -+ -+ nx = mon->wx; -+ ny = 0; -+ nw = mon->ww; -+ nh = mon->wh; -+ -+ for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) { -+ if((i % 2 && nh / 2 > 2 * c->bw) -+ || (!(i % 2) && nw / 2 > 2 * c->bw)) { -+ if(i < n - 1) { -+ if(i % 2) -+ nh /= 2; -+ else -+ nw /= 2; -+ if((i % 4) == 2 && !s) -+ nx += nw; -+ else if((i % 4) == 3 && !s) -+ ny += nh; -+ } -+ if((i % 4) == 0) { -+ if(s) -+ ny += nh; -+ else -+ ny -= nh; -+ } -+ else if((i % 4) == 1) -+ nx += nw; -+ else if((i % 4) == 2) -+ ny += nh; -+ else if((i % 4) == 3) { -+ if(s) -+ nx += nw; -+ else -+ nx -= nw; -+ } -+ if(i == 0) -+ { -+ if(n != 1) -+ nw = mon->ww * mon->mfact; -+ ny = mon->wy; -+ } -+ else if(i == 1) -+ nw = mon->ww - nw; -+ i++; -+ } -+ resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); -+ } -+} -+ -+void -+dwindle(Monitor *mon) { -+ fibonacci(mon, 1); -+} -+ -+void -+spiral(Monitor *mon) { -+ fibonacci(mon, 0); -+} --- -2.20.1 - diff --git a/patch/dwm-setborderpx-6.2.diff b/patch/dwm-setborderpx-6.2.diff deleted file mode 100644 index 6a82087..0000000 --- a/patch/dwm-setborderpx-6.2.diff +++ /dev/null @@ -1,90 +0,0 @@ -diff -up a/config.def.h b/config.def.h ---- a/config.def.h 2020-05-12 02:17:20.070933833 +0200 -+++ b/config.def.h 2020-05-13 03:27:51.018695798 +0200 -@@ -84,6 +84,9 @@ static Key keys[] = { - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_minus, setborderpx, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_plus, setborderpx, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_numbersign, setborderpx, {.i = 0 } }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) -diff -up a/dwm.c b/dwm.c ---- a/dwm.c 2020-05-12 02:17:20.070933833 +0200 -+++ b/dwm.c 2020-05-14 00:17:35.047919771 +0200 -@@ -119,6 +119,7 @@ struct Monitor { - int by; /* bar geometry */ - int mx, my, mw, mh; /* screen size */ - int wx, wy, ww, wh; /* window area */ -+ unsigned int borderpx; - unsigned int seltags; - unsigned int sellt; - unsigned int tagset[2]; -@@ -196,6 +197,7 @@ static void run(void); - static void scan(void); - static int sendevent(Client *c, Atom proto); - static void sendmon(Client *c, Monitor *m); -+static void setborderpx(const Arg *arg); - static void setclientstate(Client *c, long state); - static void setfocus(Client *c); - static void setfullscreen(Client *c, int fullscreen); -@@ -638,6 +640,7 @@ createmon(void) - m->nmaster = nmaster; - m->showbar = showbar; - m->topbar = topbar; -+ m->borderpx = borderpx; - m->lt[0] = &layouts[0]; - m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -1047,7 +1050,7 @@ manage(Window w, XWindowAttributes *wa) - /* only fix client y-offset, if the client center might cover the bar */ - c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) - && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); -- c->bw = borderpx; -+ c->bw = c->mon->borderpx; - - wc.border_width = c->bw; - XConfigureWindow(dpy, w, CWBorderWidth, &wc); -@@ -1424,6 +1427,40 @@ sendmon(Client *c, Monitor *m) - } - - void -+setborderpx(const Arg *arg) -+{ -+ Client *c; -+ int prev_borderpx = selmon->borderpx; -+ -+ if (arg->i == 0) -+ selmon->borderpx = borderpx; -+ else if (selmon->borderpx + arg->i < 0) -+ selmon->borderpx = 0; -+ else -+ selmon->borderpx += arg->i; -+ -+ for (c = selmon->clients; c; c = c->next) -+ { -+ if (c->bw + arg->i < 0) -+ c->bw = selmon->borderpx = 0; -+ else -+ c->bw = selmon->borderpx; -+ if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) -+ { -+ if (arg->i != 0 && prev_borderpx + arg->i >= 0) -+ resize(c, c->x, c->y, c->w-(arg->i*2), c->h-(arg->i*2), 0); -+ else if (arg->i != 0) -+ resizeclient(c, c->x, c->y, c->w, c->h); -+ else if (prev_borderpx > borderpx) -+ resize(c, c->x, c->y, c->w + 2*(prev_borderpx - borderpx), c->h + 2*(prev_borderpx - borderpx), 0); -+ else if (prev_borderpx < borderpx) -+ resize(c, c->x, c->y, c->w-2*(borderpx - prev_borderpx), c->h-2*(borderpx - prev_borderpx), 0); -+ } -+ } -+ arrange(selmon); -+} -+ -+void - setclientstate(Client *c, long state) - { - long data[] = { state, None }; diff --git a/patch/dwm-vanitygaps-20200610-f09418b.diff b/patch/dwm-vanitygaps-20200610-f09418b.diff deleted file mode 100644 index b921e76..0000000 --- a/patch/dwm-vanitygaps-20200610-f09418b.diff +++ /dev/null @@ -1,206 +0,0 @@ -From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001 -From: Michel Boaventura <michel.boaventura@protonmail.com> -Date: Wed, 10 Jun 2020 10:46:51 -0300 -Subject: [PATCH] Update Vanity Gaps to master - ---- - config.def.h | 21 +++++++ - dwm.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 163 insertions(+), 12 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..0927c2d 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -3,6 +3,11 @@ - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -+static const unsigned int gappih = 10; /* horiz inner gap between windows */ -+static const unsigned int gappiv = 10; /* vert inner gap between windows */ -+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ -+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */ -+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ - static const char *fonts[] = { "monospace:size=10" }; -@@ -70,6 +75,22 @@ static Key keys[] = { - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, -+ { MODKEY, XK_-, incrgaps, {.i = +1 } }, -+ { MODKEY, XK_=, incrgaps, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_-, incrogaps, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_=, incrogaps, {.i = -1 } }, -+ { MODKEY|ControlMask, XK_-, incrigaps, {.i = +1 } }, -+ { MODKEY|ControlMask, XK_=, incrigaps, {.i = -1 } }, -+ { MODKEY, XK_0, togglegaps, {0} }, -+ { MODKEY|ShiftMask, XK_0, defaultgaps, {0} }, - { 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 9fd0286..50dbbaf 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -119,6 +119,10 @@ struct Monitor { - int by; /* bar geometry */ - int mx, my, mw, mh; /* screen size */ - int wx, wy, ww, wh; /* window area */ -+ int gappih; /* horizontal gap between windows */ -+ int gappiv; /* vertical gap between windows */ -+ int gappoh; /* horizontal outer gaps */ -+ int gappov; /* vertical outer gaps */ - unsigned int seltags; - unsigned int sellt; - unsigned int tagset[2]; -@@ -200,6 +204,16 @@ 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(int oh, int ov, int ih, int iv); -+static void incrgaps(const Arg *arg); -+static void incrigaps(const Arg *arg); -+static void incrogaps(const Arg *arg); -+static void togglegaps(const Arg *arg); -+static void defaultgaps(const Arg *arg); - static void setlayout(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); -@@ -241,6 +255,7 @@ static char stext[256]; - static int screen; - static int sw, sh; /* X display screen geometry width, height */ - static int bh, blw = 0; /* bar geometry */ -+static int enablegaps = 1; /* enables gaps, used by togglegaps */ - static int lrpad; /* sum of left and right padding for text */ - static int (*xerrorxlib)(Display *, XErrorEvent *); - static unsigned int numlockmask = 0; -@@ -639,6 +654,10 @@ createmon(void) - m->nmaster = nmaster; - m->showbar = showbar; - m->topbar = topbar; -+ m->gappih = gappih; -+ m->gappiv = gappiv; -+ m->gappoh = gappoh; -+ m->gappov = gappov; - m->lt[0] = &layouts[0]; - m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen) - } - } - -+void -+setgaps(int oh, int ov, int ih, int iv) -+{ -+ if (oh < 0) oh = 0; -+ if (ov < 0) ov = 0; -+ if (ih < 0) ih = 0; -+ if (iv < 0) iv = 0; -+ -+ selmon->gappoh = oh; -+ selmon->gappov = ov; -+ selmon->gappih = ih; -+ selmon->gappiv = iv; -+ arrange(selmon); -+} -+ -+void -+togglegaps(const Arg *arg) -+{ -+ enablegaps = !enablegaps; -+ arrange(selmon); -+} -+ -+void -+defaultgaps(const Arg *arg) -+{ -+ setgaps(gappoh, gappov, gappih, gappiv); -+} -+ -+void -+incrgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrigaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrogaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ - void - setlayout(const Arg *arg) - { -@@ -1674,28 +1798,34 @@ tagmon(const Arg *arg) - void - tile(Monitor *m) - { -- unsigned int i, n, h, mw, my, ty; -+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - -+ if (smartgaps == n) { -+ oe = 0; // outer gaps disabled -+ } -+ - if (n > m->nmaster) -- mw = m->nmaster ? m->ww * m->mfact : 0; -+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * 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 - 2*m->gappov*oe + m->gappiv*ie; -+ for (i = 0, my = ty = m->gappoh*oe, 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); -+ r = MIN(n, m->nmaster) - i; -+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0); -+ if (my + HEIGHT(c) + m->gappih*ie < m->wh) -+ my += HEIGHT(c) + m->gappih*ie; - } 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); -+ r = n - i; -+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0); -+ if (ty + HEIGHT(c) + m->gappih*ie < m->wh) -+ ty += HEIGHT(c) + m->gappih*ie; - } - } - --- -2.27.0 - diff --git a/vanitygaps.c b/vanitygaps.c deleted file mode 100644 index c4e4c81..0000000 --- a/vanitygaps.c +++ /dev/null @@ -1,297 +0,0 @@ -/* function declarations */ -static void setgaps(int oh, int ov, int ih, int iv); -static void togglegaps(const Arg *arg); -static void defaultgaps(const Arg *arg); -static void incrgaps(const Arg *arg); -static void incrigaps(const Arg *arg); -static void incrogaps(const Arg *arg); -static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc); -static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr); -static void tile(Monitor *m); -static void fibonacci(Monitor *m, int s); -static void spiral(Monitor *m); -static void dwindle(Monitor *m); - - -static int enablegaps = 1; /* enables gaps, used by togglegaps */ - -void -setgaps(int oh, int ov, int ih, int iv) -{ - if (oh < 0) oh = 0; - if (ov < 0) ov = 0; - if (ih < 0) ih = 0; - if (iv < 0) iv = 0; - - selmon->gappoh = oh; - selmon->gappov = ov; - selmon->gappih = ih; - selmon->gappiv = iv; - arrange(selmon); -} - -void -togglegaps(const Arg *arg) -{ - enablegaps = !enablegaps; - arrange(selmon); -} - -void -defaultgaps(const Arg *arg) -{ - setgaps(gappoh, gappov, gappih, gappiv); -} - -void -incrgaps(const Arg *arg) -{ - setgaps( - selmon->gappoh + arg->i, - selmon->gappov + arg->i, - selmon->gappih + arg->i, - selmon->gappiv + arg->i - ); -} - -void -incrigaps(const Arg *arg) -{ - setgaps( - selmon->gappoh, - selmon->gappov, - selmon->gappih + arg->i, - selmon->gappiv + arg->i - ); -} - -void -incrogaps(const Arg *arg) -{ - setgaps( - selmon->gappoh + arg->i, - selmon->gappov + arg->i, - selmon->gappih, - selmon->gappiv - ); -} - -void -getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) -{ - unsigned int n, oe, ie; - Client *c; - - oe = ie = enablegaps; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (smartgaps && n == 1) { - oe = 0; // outer gaps disabled when only one client - } - - *oh = m->gappoh*oe; // outer horizontal gap - *ov = m->gappov*oe; // outer vertical gap - *ih = m->gappih*ie; // inner horizontal gap - *iv = m->gappiv*ie; // inner vertical gap - *nc = n; // number of clients -} - -void -getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr) -{ - unsigned int n; - float mfacts, sfacts; - int mtotal = 0, stotal = 0; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - mfacts = MIN(n, m->nmaster); - sfacts = n - m->nmaster; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) - if (n < m->nmaster) - mtotal += msize / mfacts; - else - stotal += ssize / sfacts; - - *mf = mfacts; // total factor of master area - *sf = sfacts; // total factor of stack area - *mr = msize - mtotal; // the remainder (rest) of pixels after an even master split - *sr = ssize - stotal; // the remainder (rest) of pixels after an even stack split -} -void -tile(Monitor *m) -{ - unsigned int i, n; - int oh, ov, ih, iv; - int mx = 0, my = 0, mh = 0, mw = 0; - int sx = 0, sy = 0, sh = 0, sw = 0; - float mfacts, sfacts; - int mrest, srest; - Client *c; - - getgaps(m, &oh, &ov, &ih, &iv, &n); - if (n == 0) - return; - - sx = mx = m->wx + ov; - sy = my = m->wy + oh; - mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1); - sh = m->wh - 2*oh - ih * (n - m->nmaster - 1); - sw = mw = m->ww - 2*ov; - - if (m->nmaster && n > m->nmaster) { - sw = (mw - iv) * (1 - m->mfact); - mw = mw - iv - sw; - sx = mx + mw + iv; - } - - getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest); - - for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0); - my += HEIGHT(c) + ih; - } else { - resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0); - sy += HEIGHT(c) + ih; - } -} - -void -fibonacci(Monitor *m, int s) { - unsigned int i, n; - int nx, ny, nw, nh; - int oh, ov, ih, iv; - int nv, hrest = 0, wrest = 0, r = 1; - Client *c; - - getgaps(m, &oh, &ov, &ih, &iv, &n); - if(n == 0) - return; - - nx = m->wx + ov; - ny = m->wy + oh; - nw = m->ww - 2*ov; - nh = m->wh - 2*oh; - - for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) { - if (r) { - if ((i % 2 && (nh - ih) / 2 <= (bh + 2*c->bw)) - || (!(i % 2) && (nw - iv) / 2 <= (bh + 2*c->bw))) { - r = 0; - } - if (r && i < n - 1) { - if (i % 2) { - nv = (nh - ih) / 2; - hrest = nh - 2*nv - ih; - nh = nv; - } else { - nv = (nw - iv) / 2; - wrest = nw - 2*nv - iv; - nw = nv; - } - - if ((i % 4) == 2 && !s) - nx += nw + iv; - else if ((i % 4) == 3 && !s) - ny += nh + ih; - } - - if ((i % 4) == 0) { - if (s) { - ny += nh + ih; - nh += hrest; - } - else { - nh -= hrest; - ny -= nh + ih; - } - } - else if ((i % 4) == 1) { - nx += nw + iv; - nw += wrest; - } - else if ((i % 4) == 2) { - ny += nh + ih; - nh += hrest; - if (i < n - 1) - nw += wrest; - } - else if ((i % 4) == 3) { - if (s) { - nx += nw + iv; - nw -= wrest; - } else { - nw -= wrest; - nx -= nw + iv; - nh += hrest; - } - } - if (i == 0) { - if (n != 1) { - nw = (m->ww - iv - 2*ov) - (m->ww - iv - 2*ov) * (1 - m->mfact); - wrest = 0; - } - ny = m->wy + oh; - } - else if (i == 1) - nw = m->ww - nw - iv - 2*ov; - i++; - } - - resize(c, nx, ny, nw - (2*c->bw), nh - (2*c->bw), False); - } - - /* for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) { */ - /* if((i % 2 && nh / 2 > 2 * c->bw) */ - /* || (!(i % 2) && nw / 2 > 2 * c->bw)) { */ - /* if(i < n - 1) { */ - /* if(i % 2) */ - /* nh /= 2; */ - /* else */ - /* nw /= 2; */ - /* if((i % 4) == 2 && !s) */ - /* nx += nw; */ - /* else if((i % 4) == 3 && !s) */ - /* ny += nh; */ - /* } */ - /* if((i % 4) == 0) { */ - /* if(s) */ - /* ny += nh; */ - /* else */ - /* ny -= nh; */ - /* } */ - /* else if((i % 4) == 1) */ - /* nx += nw; */ - /* else if((i % 4) == 2) */ - /* ny += nh; */ - /* else if((i % 4) == 3) { */ - /* if(s) */ - /* nx += nw; */ - /* else */ - /* nx -= nw; */ - /* } */ - /* if(i == 0) */ - /* { */ - /* if(n != 1) */ - /* nw = m->ww * m->mfact; */ - /* ny = m->wy; */ - /* } */ - /* else if(i == 1) */ - /* nw = m->ww - nw; */ - /* i++; */ - /* } */ - /* resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); */ - /* } */ -} - -void -dwindle(Monitor *m) { - fibonacci(m, 1); -} - -void -spiral(Monitor *m) { - fibonacci(m, 0); -} |
