summaryrefslogtreecommitdiff
path: root/dwm/dwm-movestack-6.6.diff
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2025-12-02 22:25:52 -0800
committerThomas Ulmer <thomasmulmer02@gmail.com>2025-12-02 22:25:52 -0800
commitca6533cc2c826862417af278a841eb736c4c98ce (patch)
tree2331382bd3402a109e9ddf4ae1abb604958b6ce7 /dwm/dwm-movestack-6.6.diff
parentf3023a0ee3d9cbcafb0df5d3c3426f74daf044b8 (diff)
dwm setup
Diffstat (limited to 'dwm/dwm-movestack-6.6.diff')
-rw-r--r--dwm/dwm-movestack-6.6.diff73
1 files changed, 73 insertions, 0 deletions
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);
++ }
++}
++