mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Adding push patch
This commit is contained in:
parent
c5b830e6ab
commit
39e161e545
@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2019-09-13 - Added titlecolor patch
|
||||
2019-09-13 - Added titlecolor and push patches
|
||||
|
||||
2019-09-12 - Added activetagindicatorbar, alwaysfullscreen and autoresize patches
|
||||
|
||||
@ -103,6 +103,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [pertag](https://dwm.suckless.org/patches/pertag/)
|
||||
- adds nmaster, mfact, layouts and more per tag rather than per monitor
|
||||
|
||||
- [push](https://dwm.suckless.org/patches/push/)
|
||||
- this patch provides a way to move clients up and down inside the client list
|
||||
|
||||
- [resizecorners](https://dwm.suckless.org/patches/resizecorners/)
|
||||
- by default, windows only resize from the bottom right corner
|
||||
- with this patch the mouse is warped to the nearest corner and you resize from there
|
||||
|
@ -235,6 +235,10 @@ static Key keys[] = {
|
||||
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
|
||||
#endif // ROTATESTACK_PATCH
|
||||
#if PUSH_PATCH
|
||||
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
|
||||
{ MODKEY|ControlMask, XK_k, pushup, {0} },
|
||||
#endif // PUSH_PATCH
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
|
@ -40,6 +40,10 @@
|
||||
#include "pertag.c"
|
||||
#endif
|
||||
|
||||
#if PUSH_PATCH
|
||||
#include "push.c"
|
||||
#endif
|
||||
|
||||
#if ROTATESTACK_PATCH
|
||||
#include "rotatestack.c"
|
||||
#endif
|
||||
|
@ -36,6 +36,10 @@
|
||||
#include "ewmhtags.h"
|
||||
#endif
|
||||
|
||||
#if PUSH_PATCH
|
||||
#include "push.h"
|
||||
#endif
|
||||
|
||||
#if ROTATESTACK_PATCH
|
||||
#include "rotatestack.h"
|
||||
#endif
|
||||
|
71
patch/push.c
Normal file
71
patch/push.c
Normal file
@ -0,0 +1,71 @@
|
||||
Client *
|
||||
nextc(Client *c, float f)
|
||||
{
|
||||
if (!f)
|
||||
return nexttiled(c);
|
||||
|
||||
for (; c && !ISVISIBLE(c); c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
static Client *
|
||||
prevc(Client *c, float f)
|
||||
{
|
||||
Client *p, *r;
|
||||
|
||||
for (p = selmon->clients, r = NULL; c && p && p != c; p = p->next)
|
||||
if ((f || !p->isfloating) && ISVISIBLE(p))
|
||||
r = p;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
pushup(const Arg *arg)
|
||||
{
|
||||
Client *sel = selmon->sel;
|
||||
Client *c;
|
||||
|
||||
if (!sel || (sel->isfloating && !arg->f))
|
||||
return;
|
||||
if ((c = prevc(sel, arg->f))) {
|
||||
/* attach before c */
|
||||
detach(sel);
|
||||
sel->next = c;
|
||||
if (selmon->clients == c)
|
||||
selmon->clients = sel;
|
||||
else {
|
||||
for (c = selmon->clients; c->next != sel->next; c = c->next);
|
||||
c->next = sel;
|
||||
}
|
||||
} else {
|
||||
/* move to the end */
|
||||
for (c = sel; c->next; c = c->next);
|
||||
detach(sel);
|
||||
sel->next = NULL;
|
||||
c->next = sel;
|
||||
}
|
||||
focus(sel);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
static void
|
||||
pushdown(const Arg *arg)
|
||||
{
|
||||
Client *sel = selmon->sel;
|
||||
Client *c;
|
||||
|
||||
if (!sel || (sel->isfloating && !arg->f))
|
||||
return;
|
||||
if ((c = nextc(sel->next, arg->f))) {
|
||||
/* attach after c */
|
||||
detach(sel);
|
||||
sel->next = c->next;
|
||||
c->next = sel;
|
||||
} else {
|
||||
/* move to the front */
|
||||
detach(sel);
|
||||
attach(sel);
|
||||
}
|
||||
focus(sel);
|
||||
arrange(selmon);
|
||||
}
|
4
patch/push.h
Normal file
4
patch/push.h
Normal file
@ -0,0 +1,4 @@
|
||||
static Client * nextc(Client *c, float f);
|
||||
static Client * prevc(Client *c, float f);
|
||||
static void pushup(const Arg *arg);
|
||||
static void pushdown(const Arg *arg);
|
@ -164,6 +164,11 @@
|
||||
*/
|
||||
#define PERTAGBAR_PATCH 0
|
||||
|
||||
/* This patch provides a way to move clients up and down inside the client list.
|
||||
* https://dwm.suckless.org/patches/push/
|
||||
*/
|
||||
#define PUSH_PATCH 0
|
||||
|
||||
/* By default, windows only resize from the bottom right corner. With this
|
||||
* patch the mouse is warped to the nearest corner and you resize from there.
|
||||
* https://dwm.suckless.org/patches/resizecorners/
|
||||
|
Loading…
x
Reference in New Issue
Block a user