diff options
| author | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
|---|---|---|
| committer | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
| commit | 8cbadb61604667b407b53ee1258433994fa4765a (patch) | |
| tree | 97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwm/patch/attachx.c | |
Diffstat (limited to 'dwm/patch/attachx.c')
| -rwxr-xr-x | dwm/patch/attachx.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dwm/patch/attachx.c b/dwm/patch/attachx.c new file mode 100755 index 0000000..0ce908a --- /dev/null +++ b/dwm/patch/attachx.c @@ -0,0 +1,59 @@ +void +attachx(Client *c) +{ + #if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBOTTOM_PATCH || SEAMLESS_RESTART_PATCH + Client *at; + #endif // ATTACHABOVE_PATCH | ATTACHASIDE_PATCH | ATTACHBOTTOM_PATCH | SEAMLESS_RESTART_PATCH + + #if SEAMLESS_RESTART_PATCH + if (c->idx > 0) { /* then the client has a designated position in the client list */ + for (at = c->mon->clients; at; at = at->next) { + if (c->idx < at->idx) { + c->next = at; + c->mon->clients = c; + return; + } else if (at->idx <= c->idx && (!at->next || c->idx <= at->next->idx)) { + c->next = at->next; + at->next = c; + return; + } + } + } + #endif // SEAMLESS_RESTART_PATCH + + #if ATTACHABOVE_PATCH + if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) { + for (at = c->mon->clients; at->next != c->mon->sel; at = at->next); + c->next = at->next; + at->next = c; + return; + } + #elif ATTACHASIDE_PATCH + unsigned int n; + for (at = c->mon->clients, n = 0; at; at = at->next) + if (!at->isfloating && ISVISIBLEONTAG(at, c->tags)) + if (++n >= c->mon->nmaster) + break; + + if (at && c->mon->nmaster) { + c->next = at->next; + at->next = c; + return; + } + #elif ATTACHBELOW_PATCH + if (!(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating)) { + c->next = c->mon->sel->next; + c->mon->sel->next = c; + return; + } + #elif ATTACHBOTTOM_PATCH + for (at = c->mon->clients; at && at->next; at = at->next); + if (at) { + at->next = c; + c->next = NULL; + return; + } + #endif + attach(c); // master (default) +} + |
