diff options
| author | Thomas Ulmer <thomasmulmer02@gmail.com> | 2025-12-02 22:25:52 -0800 |
|---|---|---|
| committer | Thomas Ulmer <thomasmulmer02@gmail.com> | 2025-12-02 22:25:52 -0800 |
| commit | ca6533cc2c826862417af278a841eb736c4c98ce (patch) | |
| tree | 2331382bd3402a109e9ddf4ae1abb604958b6ce7 | |
| parent | f3023a0ee3d9cbcafb0df5d3c3426f74daf044b8 (diff) | |
dwm setup
| -rw-r--r-- | dwm/dwm-6.6.tar.gz | bin | 0 -> 26379 bytes | |||
| -rw-r--r-- | dwm/dwm-fullgaps-6.4.diff | 94 | ||||
| -rw-r--r-- | dwm/dwm-movestack-6.6.diff | 73 | ||||
| -rw-r--r-- | dwm/dwm-quitprompt-20220718-6613d9f.diff | 92 | ||||
| -rw-r--r-- | dwm/dwm-removeborder-20220626-d3f93c7.diff | 31 | ||||
| -rw-r--r-- | dwm/dwm-warp-6.4.diff | 79 | ||||
| -rw-r--r-- | dwm/my.diff | 50 | ||||
| -rwxr-xr-x | dwm/setup.sh | 14 |
8 files changed, 339 insertions, 94 deletions
diff --git a/dwm/dwm-6.6.tar.gz b/dwm/dwm-6.6.tar.gz Binary files differnew file mode 100644 index 0000000..966b256 --- /dev/null +++ b/dwm/dwm-6.6.tar.gz diff --git a/dwm/dwm-fullgaps-6.4.diff b/dwm/dwm-fullgaps-6.4.diff deleted file mode 100644 index dc52139..0000000 --- a/dwm/dwm-fullgaps-6.4.diff +++ /dev/null @@ -1,94 +0,0 @@ -diff -up a/config.def.h b/config.def.h ---- a/config.def.h -+++ b/config.def.h -@@ -2,6 +2,7 @@ - - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ -+static const unsigned int gappx = 5; /* gaps between 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 */ -@@ -85,6 +86,9 @@ static const Key keys[] = { - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, -+ { MODKEY, XK_minus, setgaps, {.i = -1 } }, -+ { MODKEY, XK_equal, setgaps, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_equal, setgaps, {.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 2023-04-30 -+++ b/dwm.c 2023-04-30 -@@ -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 * - 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); -@@ -641,6 +643,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); -@@ -1508,6 +1511,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) - { - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) -@@ -1697,18 +1710,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++) -- 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); -+ 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) - 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; - } - } diff --git a/dwm/dwm-movestack-6.6.diff b/dwm/dwm-movestack-6.6.diff new file mode 100644 index 0000000..2fbe3f6 --- /dev/null +++ b/dwm/dwm-movestack-6.6.diff @@ -0,0 +1,73 @@ +diff -urN ../dwm-clean/config.def.h ./config.def.h +--- ../dwm-clean/config.def.h 2025-08-09 06:00:55.740267680 -0700 ++++ ./config.def.h 2025-12-02 21:53:19.180898042 -0800 +@@ -60,6 +60,7 @@ + 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 const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +@@ -71,6 +72,8 @@ + { 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 -urN ../dwm-clean/movestack.c ./movestack.c +--- ../dwm-clean/movestack.c 1969-12-31 16:00:00.000000000 -0800 ++++ ./movestack.c 2025-12-02 21:53:07.589199175 -0800 +@@ -0,0 +1,49 @@ ++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); ++ } ++} ++ diff --git a/dwm/dwm-quitprompt-20220718-6613d9f.diff b/dwm/dwm-quitprompt-20220718-6613d9f.diff new file mode 100644 index 0000000..0ffbc36 --- /dev/null +++ b/dwm/dwm-quitprompt-20220718-6613d9f.diff @@ -0,0 +1,92 @@ +From eb558048819ed916b272765e64e1ea795a85740e Mon Sep 17 00:00:00 2001 +From: Lerrrtaste <lerrrtaste@protonmail.com> +Date: Mon, 18 Jul 2022 12:22:39 +0200 +Subject: [PATCH] This Patch replaces the default quit behavior with an dmenu + prompt. Possible selections are (Quit DWM?) "yes", "no" and "restart". The + additional confirmation can save your work from accidentally hitting the quit + key by requiring two additional keystrokes (y/yes and RET). Additionally it + allows for restarting / reloading dwm without ending the xsession and closing + all open x windows. To abort press ESC or n/no and RET. + +--- + config.def.h | 2 +- + dwm.c | 30 ++++++++++++++++++++++++++++++ + 2 files changed, 31 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index a2ac963..9e3b394 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -94,7 +94,7 @@ static Key keys[] = { + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) +- { MODKEY|ShiftMask, XK_q, quit, {0} }, ++ { MODKEY|ShiftMask, XK_q, quitprompt, {0} }, + }; + + /* button definitions */ +diff --git a/dwm.c b/dwm.c +index 7c0f978..3761ba4 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -188,6 +188,7 @@ static Client *nexttiled(Client *c); + static void pop(Client *c); + static void propertynotify(XEvent *e); + static void quit(const Arg *arg); ++static void quitprompt(const Arg *arg); + static Monitor *recttomon(int x, int y, int w, int h); + static void resize(Client *c, int x, int y, int w, int h, int interact); + static void resizeclient(Client *c, int x, int y, int w, int h); +@@ -262,6 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { + }; + static Atom wmatom[WMLast], netatom[NetLast]; + static int running = 1; ++static int restart = 1; + static Cur *cursor[CurLast]; + static Clr **scheme; + static Display *dpy; +@@ -1258,6 +1260,31 @@ quit(const Arg *arg) + running = 0; + } + ++void ++quitprompt(const Arg *arg) ++{ ++ FILE *pp = popen("echo -e \"no\nrestart\nyes\" | dmenu -i -sb red -p \"Quit DWM?\"", "r"); ++ if(pp != NULL) { ++ char buf[1024]; ++ if (fgets(buf, sizeof(buf), pp) == NULL) { ++ fprintf(stderr, "Quitprompt: Error reading pipe!\n"); ++ return; ++ } ++ if (strcmp(buf, "yes\n") == 0) { ++ pclose(pp); ++ restart = 0; ++ quit(NULL); ++ } else if (strcmp(buf, "restart\n") == 0) { ++ pclose(pp); ++ restart = 1; ++ quit(NULL); ++ } else if (strcmp(buf, "no\n") == 0) { ++ pclose(pp); ++ return; ++ } ++ } ++} ++ + Monitor * + recttomon(int x, int y, int w, int h) + { +@@ -2155,5 +2182,8 @@ main(int argc, char *argv[]) + run(); + cleanup(); + XCloseDisplay(dpy); ++ if (restart == 1) { ++ execlp("dwm", "dwm", NULL); ++ } + return EXIT_SUCCESS; + } +-- +2.36.0 + diff --git a/dwm/dwm-removeborder-20220626-d3f93c7.diff b/dwm/dwm-removeborder-20220626-d3f93c7.diff new file mode 100644 index 0000000..9193a77 --- /dev/null +++ b/dwm/dwm-removeborder-20220626-d3f93c7.diff @@ -0,0 +1,31 @@ +diff --git a/dwm.c b/dwm.c +index 5646a5c..27e29df 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -1283,12 +1283,26 @@ void + resizeclient(Client *c, int x, int y, int w, int h) + { + XWindowChanges wc; ++ unsigned int n; ++ Client *nbc; + + c->oldx = c->x; c->x = wc.x = x; + c->oldy = c->y; c->y = wc.y = y; + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ ++ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); ++ ++ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { ++ } else { ++ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { ++ wc.border_width = 0; ++ c->w = wc.width += c->bw * 2; ++ c->h = wc.height += c->bw * 2; ++ } ++ } ++ + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); diff --git a/dwm/dwm-warp-6.4.diff b/dwm/dwm-warp-6.4.diff new file mode 100644 index 0000000..02fcdba --- /dev/null +++ b/dwm/dwm-warp-6.4.diff @@ -0,0 +1,79 @@ +From a229c36f51ad6f8b40109ed53c643f242351962a Mon Sep 17 00:00:00 2001 +From: Jonas Dujava <jonas.dujava@gmail.com> +Date: Fri, 26 May 2023 22:14:48 +0200 +Subject: [PATCH] Warp patch + +Warps the mouse cursor to the center of the currently focused +window or screen when the mouse cursor is + (a) on a different screen, or + (b) on top of a different window. + +This version properly handles warping to windows that have not been +mapped yet (before it resulted in a change of the stack order). +See the discussion in (thanks goes to Bakkeby): + https://github.com/bakkeby/patches/issues/60 +--- + dwm.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/dwm.c b/dwm.c +index e5efb6a..7ea6c14 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -228,6 +228,7 @@ static void updatetitle(Client *c); + static void updatewindowtype(Client *c); + static void updatewmhints(Client *c); + static void view(const Arg *arg); ++static void warp(const Client *c); + static Client *wintoclient(Window w); + static Monitor *wintomon(Window w); + static int xerror(Display *dpy, XErrorEvent *ee); +@@ -834,6 +835,7 @@ focusmon(const Arg *arg) + unfocus(selmon->sel, 0); + selmon = m; + focus(NULL); ++ warp(selmon->sel); + } + + void +@@ -1366,6 +1368,8 @@ restack(Monitor *m) + wc.sibling = c->win; + } + } ++ if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && m->lt[m->sellt]->arrange != &monocle) ++ warp(m->sel); + XSync(dpy, False); + while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + } +@@ -2044,6 +2048,28 @@ view(const Arg *arg) + arrange(selmon); + } + ++void ++warp(const Client *c) ++{ ++ int x, y; ++ ++ if (!c) { ++ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2); ++ return; ++ } ++ ++ if (!getrootptr(&x, &y) || ++ (x > c->x - c->bw && ++ y > c->y - c->bw && ++ x < c->x + c->w + c->bw*2 && ++ y < c->y + c->h + c->bw*2) || ++ (y > c->mon->by && y < c->mon->by + bh) || ++ (c->mon->topbar && !y)) ++ return; ++ ++ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2); ++} ++ + Client * + wintoclient(Window w) + { +-- +2.40.1 + diff --git a/dwm/my.diff b/dwm/my.diff new file mode 100644 index 0000000..be0f560 --- /dev/null +++ b/dwm/my.diff @@ -0,0 +1,50 @@ +diff -urN ../dwm-clean/config.def.h ./config.def.h +--- ../dwm-clean/config.def.h 2025-08-09 06:00:55.740267680 -0700 ++++ ./config.def.h 2025-12-02 22:11:33.586005536 -0800 +@@ -2,7 +2,7 @@ + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ +-static const unsigned int snap = 32; /* snap pixel */ ++static const unsigned int snap = 1; /* snap pixel */ + 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" }; +@@ -11,11 +11,11 @@ + 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 char col_purple[] = "#6904f7"; + static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeSel] = { col_gray4, col_purple, col_purple }, + }; + + /* tagging */ +@@ -45,7 +45,7 @@ + }; + + /* key definitions */ +-#define MODKEY Mod1Mask ++#define MODKEY Mod4Mask + #define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ +@@ -57,12 +57,12 @@ + + /* commands */ + 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 *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_purple, "-sf", col_gray4, NULL }; + static const char *termcmd[] = { "st", NULL }; + + static const Key keys[] = { + /* modifier key function argument */ +- { MODKEY, XK_p, spawn, {.v = dmenucmd } }, ++ { MODKEY, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, diff --git a/dwm/setup.sh b/dwm/setup.sh new file mode 100755 index 0000000..01e3f4a --- /dev/null +++ b/dwm/setup.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e +set -x + +tar -xzf dwm-6.6.tar.gz +cd dwm-6.6 +patch <../my.diff +patch <../dwm-movestack-6.6.diff +patch <../dwm-quitprompt-20220718-6613d9f.diff +patch <../dwm-warp-6.4.diff +patch <../dwm-removeborder-20220626-d3f93c7.diff +make config.h +sudo make install |
