Compare commits

...

10 commits
0.7 ... push

Author SHA1 Message Date
Devin J. Pohly
7c3c5ffcc2 Merge branch 'main' into push 2023-07-03 22:06:26 -05:00
Devin J. Pohly
81c8ebf677 Merge branch 'push' of github:Abanoub8/dwl into push 2023-07-03 22:05:05 -05:00
Devin J. Pohly
a89872f02e Merge branch 'push' of github:djpohly/dwl into push 2023-07-03 22:04:38 -05:00
Abanoub
a41d817979
Use focustop(selmon) instead of selclient() in the push patch 2023-06-21 18:11:09 +03:00
Devin J. Pohly
a4e4fd3d25
add missing header 2022-12-05 22:58:26 -06:00
Devin J. Pohly
0259e9a8ab
port dwm "push" patch to dwl 2022-12-05 22:58:26 -06:00
Devin J. Pohly
04079a0946 Merge branch 'wlroots-next' into push 2021-04-26 07:34:59 -05:00
Devin J. Pohly
daf5ee475f Merge branch 'main' into push 2021-03-10 15:37:57 -06:00
Devin J. Pohly
156a13d9f9 add missing header 2021-03-04 13:52:58 -06:00
Devin J. Pohly
dcb7a4d910 port dwm "push" patch to dwl 2021-03-04 00:45:50 -06:00
4 changed files with 70 additions and 1 deletions

View file

@ -16,7 +16,7 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
all: dwl all: dwl
dwl: dwl.o util.o dwl: dwl.o util.o
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@ $(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
dwl.o: dwl.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h dwl.o: dwl.c push.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
util.o: util.c util.h util.o: util.c util.h
# wayland-scanner is a tool which generates C headers and rigging for Wayland # wayland-scanner is a tool which generates C headers and rigging for Wayland

2
dwl.c
View file

@ -408,7 +408,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
View 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 = focustop(selmon);
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 = focustop(selmon);
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);
}

4
push.h Normal file
View file

@ -0,0 +1,4 @@
static Client *nexttiled(Client *sel);
static Client *prevtiled(Client *sel);
static void pushdown(const Arg *arg);
static void pushup(const Arg *arg);