mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-28 04:33:01 -08:00
port dwm "push" patch to dwl
This commit is contained in:
parent
b063dd89c3
commit
dcb7a4d910
3 changed files with 67 additions and 0 deletions
2
Makefile
2
Makefile
|
@ -49,6 +49,8 @@ config.h: | config.def.h
|
||||||
|
|
||||||
dwl.o: config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h idle-protocol.h
|
dwl.o: config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h idle-protocol.h
|
||||||
|
|
||||||
|
dwl.o: push.c
|
||||||
|
|
||||||
dwl: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o idle-protocol.o
|
dwl: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o idle-protocol.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
2
dwl.c
2
dwl.c
|
@ -369,7 +369,9 @@ static Atom netatom[NetLast];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
|
#include "push.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "push.c"
|
||||||
|
|
||||||
/* attempt to encapsulate suck into one file */
|
/* attempt to encapsulate suck into one file */
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
63
push.c
Normal file
63
push.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
static Client *
|
||||||
|
nexttiled(Client *sel) {
|
||||||
|
Client *c;
|
||||||
|
wl_list_for_each(c, &sel->link, link) {
|
||||||
|
if (&c->link == &clients)
|
||||||
|
break; /* don't wrap */
|
||||||
|
if (!c->isfloating && VISIBLEON(c, selmon))
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Client *
|
||||||
|
prevtiled(Client *sel) {
|
||||||
|
Client *c;
|
||||||
|
wl_list_for_each_reverse(c, &sel->link, link) {
|
||||||
|
if (&c->link == &clients)
|
||||||
|
break; /* don't wrap */
|
||||||
|
if (!c->isfloating && VISIBLEON(c, selmon))
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pushup(const Arg *arg) {
|
||||||
|
Client *sel = selclient();
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(!sel || sel->isfloating)
|
||||||
|
return;
|
||||||
|
if((c = prevtiled(sel))) {
|
||||||
|
/* attach before c */
|
||||||
|
wl_list_remove(&sel->link);
|
||||||
|
wl_list_insert(c->link.prev, &sel->link);
|
||||||
|
} else {
|
||||||
|
/* move to the end */
|
||||||
|
wl_list_remove(&sel->link);
|
||||||
|
wl_list_insert(clients.prev, &sel->link);
|
||||||
|
}
|
||||||
|
focusclient(sel, 1);
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pushdown(const Arg *arg) {
|
||||||
|
Client *sel = selclient();
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(!sel || sel->isfloating)
|
||||||
|
return;
|
||||||
|
if((c = nexttiled(sel))) {
|
||||||
|
/* attach after c */
|
||||||
|
wl_list_remove(&sel->link);
|
||||||
|
wl_list_insert(&c->link, &sel->link);
|
||||||
|
} else {
|
||||||
|
/* move to the front */
|
||||||
|
wl_list_remove(&sel->link);
|
||||||
|
wl_list_insert(&clients, &sel->link);
|
||||||
|
}
|
||||||
|
focusclient(sel, 1);
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
Loading…
Reference in a new issue