diff options
| author | Thomas Ulmer <thomasmulmer02@gmail.com> | 2026-02-13 09:22:47 -0800 |
|---|---|---|
| committer | Thomas Ulmer <thomasmulmer02@gmail.com> | 2026-02-13 09:22:47 -0800 |
| commit | 8d2258410c02a190c69ac51179d6c8793443d678 (patch) | |
| tree | c0b1173ec225a4519fc81b9033a4623db1fae188 /src/dwm/my-dwm/movestack.c | |
| parent | 4e0fe99c05390ad76c9307fcfc743feeeaa83b1f (diff) | |
dwm try single tagsset
Diffstat (limited to 'src/dwm/my-dwm/movestack.c')
| -rw-r--r-- | src/dwm/my-dwm/movestack.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/dwm/my-dwm/movestack.c b/src/dwm/my-dwm/movestack.c new file mode 100644 index 0000000..c040462 --- /dev/null +++ b/src/dwm/my-dwm/movestack.c @@ -0,0 +1,49 @@ +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); + } +} + |
