sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1f1f11f631003e21c9d2983fb57c4280608308a3
parent 6608b1c10c472d05333f70ef127313398a239b89
Author: memeplex <carlosjosepita@gmail.com>
Date:   Mon, 13 Jan 2014 23:13:15 -0300

stacker patch: add focus/push prev sel client.

Also: documentation was updated to reflect addition and xtile patch was updated to reduce
merge conflicts for people using both xtile and stacker.

Diffstat:
Mdwm.suckless.org/patches/dwm-6.0-stacker.diff | 49+++++++++++++++++++++++++++++--------------------
Mdwm.suckless.org/patches/dwm-6.0-xtile.diff | 8++++----
Mdwm.suckless.org/patches/stacker.md | 43++++++++++++++++++++++++-------------------
3 files changed, 57 insertions(+), 43 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.0-stacker.diff b/dwm.suckless.org/patches/dwm-6.0-stacker.diff @@ -1,22 +1,23 @@ diff --git a/config.def.h b/config.def.h -index 77ff358..236800d 100644 +index 77ff358..566e0c7 100644 --- a/config.def.h +++ b/config.def.h -@@ -41,6 +41,13 @@ static const Layout layouts[] = { +@@ -41,6 +41,14 @@ static const Layout layouts[] = { { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, +#define STACKKEYS(MOD,ACTION) \ + { MOD, XK_j, ACTION##stack, {.i = INC(+1) } }, \ + { MOD, XK_k, ACTION##stack, {.i = INC(-1) } }, \ -+ { MOD, XK_grave, ACTION##stack, {.i = 0 } }, \ -+ { MOD, XK_q, ACTION##stack, {.i = 1 } }, \ -+ { MOD, XK_a, ACTION##stack, {.i = 2 } }, \ -+ { MOD, XK_z, ACTION##stack, {.i = -1 } }, ++ { MOD, XK_grave, ACTION##stack, {.i = PREVSEL } }, \ ++ { MOD, XK_q, ACTION##stack, {.i = 0 } }, \ ++ { MOD, XK_a, ACTION##stack, {.i = 1 } }, \ ++ { MOD, XK_z, ACTION##stack, {.i = 2 } }, \ ++ { MOD, XK_x, ACTION##stack, {.i = -1 } }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } -@@ -54,8 +61,8 @@ static Key keys[] = { +@@ -54,8 +62,8 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, @@ -27,7 +28,7 @@ index 77ff358..236800d 100644 { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, -@@ -83,7 +90,7 @@ static Key keys[] = { +@@ -83,7 +91,7 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) @@ -37,19 +38,20 @@ index 77ff358..236800d 100644 /* button definitions */ diff --git a/dwm.c b/dwm.c -index 1d78655..8bded5d 100644 +index 1d78655..6129f56 100644 --- a/dwm.c +++ b/dwm.c -@@ -43,17 +43,22 @@ +@@ -43,17 +43,23 @@ /* macros */ #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) -+#define GETINC(X) ((X) < 0 ? X + 1000 : X - 1000) -+#define INC(X) ((X) < 0 ? X - 1000 : X + 1000) ++#define GETINC(X) ((X) - 2000) ++#define INC(X) ((X) + 2000) #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) -+#define ISINC(X) ((X) <= -1000 || (X) >= 1000) ++#define ISINC(X) ((X) > 1000 && (X) < 3000) #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) ++#define PREVSEL 3000 #define LENGTH(X) (sizeof X / sizeof X[0]) #define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B)) @@ -63,7 +65,7 @@ index 1d78655..8bded5d 100644 /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -@@ -205,6 +210,7 @@ static void movemouse(const Arg *arg); +@@ -205,6 +211,7 @@ static void movemouse(const Arg *arg); static Client *nexttiled(Client *c); static void pop(Client *); static void propertynotify(XEvent *e); @@ -71,7 +73,7 @@ index 1d78655..8bded5d 100644 static void quit(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, Bool interact); -@@ -224,6 +230,7 @@ static void setup(void); +@@ -224,6 +231,7 @@ static void setup(void); static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); @@ -79,7 +81,7 @@ index 1d78655..8bded5d 100644 static void tag(const Arg *arg); static void tagmon(const Arg *arg); static int textnw(const char *text, unsigned int len); -@@ -887,28 +894,16 @@ focusmon(const Arg *arg) { +@@ -887,28 +895,16 @@ focusmon(const Arg *arg) { void focusstack(const Arg *arg) { @@ -116,7 +118,7 @@ index 1d78655..8bded5d 100644 } Atom -@@ -1324,6 +1319,29 @@ propertynotify(XEvent *e) { +@@ -1324,6 +1320,29 @@ propertynotify(XEvent *e) { } void @@ -146,19 +148,26 @@ index 1d78655..8bded5d 100644 quit(const Arg *arg) { running = False; } -@@ -1674,6 +1692,29 @@ spawn(const Arg *arg) { +@@ -1674,6 +1693,36 @@ spawn(const Arg *arg) { } } +int +stackpos(const Arg *arg) { + int n, i; -+ Client *c; ++ Client *c, *l; + + if(!selmon->clients) + return -1; + -+ if(ISINC(arg->i)) { ++ if(arg->i == PREVSEL) { ++ for(l = selmon->stack; l && (!ISVISIBLE(l) || l == selmon->sel); l = l->snext); ++ if(!l) ++ return -1; ++ for(i = 0, c = selmon->clients; c != l; i += ISVISIBLE(c) ? 1 : 0, c = c->next); ++ return i; ++ } ++ else if(ISINC(arg->i)) { + if(!selmon->sel) + return -1; + for(i = 0, c = selmon->clients; c != selmon->sel; i += ISVISIBLE(c) ? 1 : 0, c = c->next); diff --git a/dwm.suckless.org/patches/dwm-6.0-xtile.diff b/dwm.suckless.org/patches/dwm-6.0-xtile.diff @@ -46,18 +46,18 @@ index 77ff358..ac895db 100644 { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/dwm.c b/dwm.c -index c9ad1f2..5dd2673 100644 +index c9ad1f2..9cae5b5 100644 --- a/dwm.c +++ b/dwm.c @@ -43,17 +43,22 @@ /* macros */ #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) -+#define GETINC(X) ((X) < 0 ? X + 1000 : X - 1000) -+#define INC(X) ((X) < 0 ? X - 1000 : X + 1000) ++#define GETINC(X) ((X) - 2000) ++#define INC(X) ((X) + 2000) #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) -+#define ISINC(X) ((X) <= -1000 || (X) >= 1000) ++#define ISINC(X) ((X) > 1000 && (X) < 3000) #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MAX(A, B) ((A) > (B) ? (A) : (B)) diff --git a/dwm.suckless.org/patches/stacker.md b/dwm.suckless.org/patches/stacker.md @@ -4,21 +4,24 @@ Stacker Description ----------- -This patch provides basic utilities for managing the client stack. It implements two new -commands: `focusstack` (which is a replacement for the original `focusstack` command) and -`pushstack`. The first one is for focusing clients while the second one moves clients -around the stack. Both commands take the same kind of argument: +This patch provides comprehensive utilities for managing the client stack. It implements +two new commands: `focusstack` (which is a replacement for the original `focusstack` +command) and `pushstack`. The first one is for focusing clients while the second one moves +clients around the stack. Both commands take the same kind of argument: -* Pass `INC(inc)` to focus/push relatively to the selected client. This will wrap around the - stack limits. +* Pass `PREVSEL` to focus/push the previously selected client in the current tagset. + +* Pass `INC(+/-inc)` to focus/push relatively to the selected client. This will wrap + around the stack limits. * Pass a positive number to focus/push relatively to the beginning of the stack. Out of - limit values will be truncated to the position of the last visible client and won't - wrap around. + limit values will be truncated to the position of the last visible client and won't wrap + around. * Pass a negative number to focus/push relatively to the last visible client in the stack. Here -1 means the last client, -2 the previous to last client, etc. Out of limit values - will be truncated to the position of the first visible client (0) and won't wrap around. + will be truncated to the position of the first visible client (0) and won't wrap + around. Default key bindings -------------------- @@ -29,18 +32,20 @@ simply `MODKEY` for the `focus*` family and `MODKEY|ShiftMask` for the `push*` f Key | Argument | Description :------:|:-----------:|----------------------- + \` | `PREVSEL` | Previously selected `j` | `INC(+1)` | Next to selected `k` | `INC(-1)` | Previous to selected - \` | `0` | First position - `q` | `1` | Second position - `a` | `2` | Third position - `z` | `-1` | Last position - -The \`, `q`, `a`, `z` keys are aligned more or less in the same keyboard column in the us -layout. The first three are intended to be used as quick positional shortcuts to specific -applications. So if you have 9 tags you get 9\*3=27 shortcuts in a two-level hierarchy of -windows. The `z` key is more like "I don't care so much about you just right now but you -can still live in this tag". + `q` | `0` | First position + `a` | `1` | Second position + `z` | `2` | Third position + `x` | `-1` | Last position + +The `q`, `a`, `z` keys are aligned more or less vertically in the us keyboard layout. They +are intended to be used as quick positional shortcuts to specific applications. So if you +have 9 tags you get 9\*3=27 shortcuts in a two-level hierarchy of clients. The \` key is +above the `Tab` key and it's intended to complement the "move to previously selected +tag" function of dwm at the intra-tag level. Finally, the `x` key is like "I don't care so +much about you just right now but you can still live in this tag". Notice that `MODKEY|ShiftMask+q` collides with the default binding for quitting dwm, which stacker changes to `MODKEY|ShiftMask+BackSpace`.