summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dwm/dwm-6.6/config.def.h10
-rw-r--r--src/dwm/dwm-6.6/movestack.c79
2 files changed, 42 insertions, 47 deletions
diff --git a/src/dwm/dwm-6.6/config.def.h b/src/dwm/dwm-6.6/config.def.h
index 3fee16b..7a94e14 100644
--- a/src/dwm/dwm-6.6/config.def.h
+++ b/src/dwm/dwm-6.6/config.def.h
@@ -69,9 +69,7 @@ static const char *upvol[] = { "volumeup", NULL };
static const char *downvol[] = { "volumedown", NULL };
static const char *mutevol[] = { "volumemute", NULL };
-/*
- * #include "movestack.c"
- */
+#include "movestack.c"
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
@@ -90,10 +88,8 @@ static const Key keys[] = {
{ MODKEY, XK_o, 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|ShiftMask, XK_j, movestack, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_w, selectclient, {0} },
diff --git a/src/dwm/dwm-6.6/movestack.c b/src/dwm/dwm-6.6/movestack.c
index c040462..0239b20 100644
--- a/src/dwm/dwm-6.6/movestack.c
+++ b/src/dwm/dwm-6.6/movestack.c
@@ -1,49 +1,48 @@
void
movestack(const Arg *arg) {
- Client *c = NULL, *p = NULL, *pc = NULL, *i;
+ 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);
+ if(arg->i > 0) {
+ /* find the client after selmon->sel */
+ for(c = selmon->sel->next; c && (!ISVISIBLE(c, selmon) || c->isfloating); c = c->next);
+ if(!c)
+ for(c = selmon->cl->clients; c && (!ISVISIBLE(c, selmon) || 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;
- }
+ }
+ else {
+ /* find the client before selmon->sel */
+ for(i = selmon->cl->clients; i != selmon->sel; i = i->next)
+ if(ISVISIBLE(i,selmon) && !i->isfloating)
+ c = i;
+ if(!c)
+ for(; i; i = i->next)
+ if(ISVISIBLE(i,selmon) && !i->isfloating)
+ c = i;
+ }
+ /* find the client before selmon->sel and c */
+ for(i = selmon->cl->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;
+ /* 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(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;
+ if(selmon->sel == selmon->cl->clients)
+ selmon->cl->clients = c;
+ else if(c == selmon->cl->clients)
+ selmon->cl->clients = selmon->sel;
- arrange(selmon);
- }
+ arrange(selmon);
+ }
}
-