about summary refs log tree commit diff
path: root/patches
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 16:45:56 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 16:45:56 +0200
commit8e4ab04fa40ba71391ab4b3abb90b94f36cb816f (patch)
treedcd08f02d5bdb7019b8be693e869e9356e1a9e21 /patches
parentAdded separators in the status script (diff)
downloaddwm-8e4ab04fa40ba71391ab4b3abb90b94f36cb816f.tar.gz
dwm-8e4ab04fa40ba71391ab4b3abb90b94f36cb816f.tar.bz2
dwm-8e4ab04fa40ba71391ab4b3abb90b94f36cb816f.zip
Added movestack [Patch]
Diffstat (limited to 'patches')
-rw-r--r--patches/dwm-movestack-6.1.diff73
1 files changed, 73 insertions, 0 deletions
diff --git a/patches/dwm-movestack-6.1.diff b/patches/dwm-movestack-6.1.diff
new file mode 100644
index 0000000..a6c83fa
--- /dev/null
+++ b/patches/dwm-movestack-6.1.diff
@@ -0,0 +1,73 @@
+diff -r 050d521d66d8 config.def.h
+--- a/config.def.h	Tue Aug 24 13:13:20 2010 +0100
++++ b/config.def.h	Sun Sep 05 18:43:07 2010 +0200
+@@ -57,6 +57,7 @@
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
+ static const char *termcmd[]  = { "st", NULL };
+ 
++#include "movestack.c"
+ static Key keys[] = {
+ 	/* modifier                     key        function        argument */
+ 	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
+@@ -68,6 +69,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 -r 050d521d66d8 movestack.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/movestack.c	Sun Sep 05 18:43:07 2010 +0200
+@@ -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);
++	}
++}
++