From 3d6a4cd879c3d123104861d0b20d2351cdd91aca Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 15 Oct 2025 15:53:23 +0100 Subject: =?UTF-8?q?=E2=9C=A8feat:=20apply=20dwm-push=5Fno=5Fmaster-6.4=20p?= =?UTF-8?q?atch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dwm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 2b5dd07..ef5976a 100644 --- a/dwm.c +++ b/dwm.c @@ -202,7 +202,10 @@ static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); static Client *nexttiled(Client *c); static void pop(Client *c); +static Client *prevtiled(Client *c); static void propertynotify(XEvent *e); +static void pushdown(const Arg *arg); +static void pushup(const Arg *arg); 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, int bw, int interact); @@ -1326,6 +1329,16 @@ pop(Client *c) arrange(c->mon); } +Client * +prevtiled(Client *c) { + Client *p, *r; + + for(p = selmon->clients, r = NULL; p && p != c; p = p->next) + if(!p->isfloating && ISVISIBLE(p)) + r = p; + return r; +} + void propertynotify(XEvent *e) { @@ -1363,6 +1376,37 @@ propertynotify(XEvent *e) } } +void +pushdown(const Arg *arg) { + Client *sel = selmon->sel, *c; + + if(!sel || sel->isfloating || sel == nexttiled(selmon->clients)) + return; + if((c = nexttiled(sel->next))) { + detach(sel); + sel->next = c->next; + c->next = sel; + } + focus(sel); + arrange(selmon); +} + +void +pushup(const Arg *arg) { + Client *sel = selmon->sel, *c; + + if(!sel || sel->isfloating) + return; + if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) { + detach(sel); + sel->next = c; + for(c = selmon->clients; c->next != sel->next; c = c->next); + c->next = sel; + } + focus(sel); + arrange(selmon); +} + void quit(const Arg *arg) { -- cgit v1.2.3