movestack patch
This commit is contained in:
parent
3eb84701d7
commit
1bdfed1d0d
@ -67,3 +67,4 @@ Most patches can be found on the suckless website: [https://dwm.suckless.org/pat
|
||||
* [combo](https://dwm.suckless.org/patches/combo/) - Select multiple tags for tag or view by pressing all the right keys as a combo
|
||||
* [cool autostart](https://dwm.suckless.org/patches/cool_autostart/) - Execute commands from `autostart` array in `config.h` on startup and kill processes upon dwm exit
|
||||
* [fixborders](https://dwm.suckless.org/patches/alpha/) - Make borders opaque
|
||||
* [movestack](https://dwm.suckless.org/patches/movestack/) - Move clients around in the stack and swap them with the master
|
||||
|
78
config.def.h
78
config.def.h
@ -56,7 +56,7 @@ static const char *const autostart[] = {
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
static const char *tags[] = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
@ -64,8 +64,9 @@ static const Rule rules[] = {
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask iscentered isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||
// { "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||
// { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||
{ "origin", NULL, NULL, 0, 1, 1, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -97,7 +98,7 @@ static const Layout layouts[] = {
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define MODKEY Mod4Mask /* Mod1Mask = Alt, Mod4Mask = Super */
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
@ -108,41 +109,59 @@ static const Layout layouts[] = {
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* 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 *termcmd[] = { "st", NULL };
|
||||
static const char *rofiruncmd[] = { "rofi", "-show", "drun", NULL };
|
||||
static const char *roficlipcmd[] = { "rofi", "-show", "clipboard", NULL };
|
||||
static const char *lockcmd[] = { "light-locker-command", "--lock", NULL };
|
||||
static const char *sleepcmd[] = { "systemctl", "suspend", NULL };
|
||||
static const char *termcmd[] = { "alacritty", NULL };
|
||||
static const char *upvolcmd[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "+1%", NULL };
|
||||
static const char *downvolcmd[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "-1%", NULL };
|
||||
static const char *mutevolcmd[] = { "/usr/bin/pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
|
||||
static const char *brightness_up[] = { "xbacklight", "-inc", "1", NULL };
|
||||
static const char *brightness_down[] = { "xbacklight", "-dec", "1", NULL };
|
||||
static const char *playerplaypausecmd[] = { "playerctl", "--player=playerctld", "play-pause", NULL };
|
||||
static const char *playernextcmd[] = { "playerctl", "--player=playerctld", "next", NULL };
|
||||
static const char *playerprevcmd[] = { "playerctl", "--player=playerctld", "previous", NULL };
|
||||
static const char *flameshotcmd[] = { "flameshot", "gui", NULL };
|
||||
|
||||
#include "movestack.c"
|
||||
#include <X11/XF86keysym.h>
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_p, spawn, {.v = rofiruncmd} },
|
||||
{ MODKEY, XK_c, spawn, {.v = roficlipcmd} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_l, spawn, {.v = lockcmd} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_s, spawn, {.v = sleepcmd} },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_j, movestack, {.i = +1 } },
|
||||
{ MODKEY|ControlMask, XK_k, movestack, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
|
||||
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
|
||||
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
|
||||
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
|
||||
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||
{ MODKEY|ControlMask, XK_u, incrgaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_i, incrigaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_o, incrogaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_6, incrihgaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_7, incrivgaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_8, incrohgaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_9, incrovgaps, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_0, togglegaps, {0} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||
{ MODKEY, XK_Tab, comboview, {0} },
|
||||
{ MODKEY|ShiftMask, XK_j, aspectresize, {.i = +24} },
|
||||
{ MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} },
|
||||
@ -160,6 +179,15 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvolcmd} },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = mutevolcmd} },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvolcmd} },
|
||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = brightness_up} },
|
||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = brightness_down} },
|
||||
{ 0, XF86XK_AudioPlay, spawn, {.v = playerplaypausecmd} },
|
||||
{ 0, XF86XK_AudioNext, spawn, {.v = playernextcmd} },
|
||||
{ 0, XF86XK_AudioPrev, spawn, {.v = playerprevcmd} },
|
||||
{ 0, XK_Print, spawn, {.v = flameshotcmd} },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
|
4
dwm.1
4
dwm.1
@ -131,10 +131,10 @@ Close focused window.
|
||||
.B Mod1\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
.B Mod1\-Shift\-f
|
||||
.B Mod1\-Control\-f
|
||||
Toggle fullscreen (actualfullscreen patch).
|
||||
.TP
|
||||
.B Mod1\-Shift\-tab
|
||||
.B Mod1\-Control\-tab
|
||||
Toggle attach below (attachbelow patch).
|
||||
.TP
|
||||
.B Mod1\-Tab
|
||||
|
2
dwm.c
2
dwm.c
@ -1921,8 +1921,6 @@ sigchld(int unused)
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
dmenumon[0] = '0' + selmon->num;
|
||||
if (fork() == 0) {
|
||||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
|
49
movestack.c
Normal file
49
movestack.c
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
|
73
patches/dwm-movestack-6.1.diff
Normal file
73
patches/dwm-movestack-6.1.diff
Normal file
@ -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);
|
||||
+ }
|
||||
+}
|
||||
+
|
Loading…
x
Reference in New Issue
Block a user