summaryrefslogtreecommitdiff
path: root/movestack.c
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-08-16 18:44:43 +0300
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-08-16 18:44:43 +0300
commit1dec076282eae69d44e5aa3168ae8ed0e7bfb94d (patch)
treebba9b2448b4d07c7df79898d31ec6c6327a21bf0 /movestack.c
parent15346749a4ce015906ed1a98f60c335cf8c07745 (diff)
Patched dwm according to current configuration.
Changes to be committed: modified: config.def.h new file: config.def.h.orig new file: config.def.h.rej new file: config.h new file: drw.c.orig modified: dwm.1 new file: dwm.1.orig modified: dwm.c new file: dwm.c.orig new file: dwm.c.rej new file: movestack.c new file: patches/dwm-actualfullscreen-20211013-cb3f58a.diff new file: patches/dwm-adjacenttag-skipvacant-6.2.diff new file: patches/dwm-alttagsdecoration-2020010304-cb3f58a.diff new file: patches/dwm-alwayscenter-20200625-f04cac6.diff new file: patches/dwm-attachbottom-6.3.diff new file: patches/dwm-fixborders-6.2.diff new file: patches/dwm-movestack-20211115-a786211.diff new file: patches/dwm-pertag-20200914-61bb8b2.diff new file: patches/dwm-uselessgap-20211119-58414bee958f2.diff
Diffstat (limited to 'movestack.c')
-rw-r--r--movestack.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/movestack.c b/movestack.c
new file mode 100644
index 0000000..520f4ae
--- /dev/null
+++ b/movestack.c
@@ -0,0 +1,48 @@
+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);
+ }
+} \ No newline at end of file