diff options
| author | bakkeby <[email protected]> | 2020-01-26 07:32:00 +0100 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-01-26 15:32:14 +0100 |
| commit | 84b0361b65ab17d1b167ad9dbfcab0524ef4bfde (patch) | |
| tree | bf3d45a006bc8416f750eda0595c1ee81ad37c0a /patch/transfer.c | |
| parent | 60209c98d773c37e4def81e5334fa159d86fac45 (diff) | |
| download | dwm-flexipatch-84b0361b65ab17d1b167ad9dbfcab0524ef4bfde.tar.gz dwm-flexipatch-84b0361b65ab17d1b167ad9dbfcab0524ef4bfde.zip | |
Adding transfer patch
Diffstat (limited to 'patch/transfer.c')
| -rw-r--r-- | patch/transfer.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/patch/transfer.c b/patch/transfer.c new file mode 100644 index 0000000..f667416 --- /dev/null +++ b/patch/transfer.c @@ -0,0 +1,33 @@ +void +transfer(const Arg *arg) +{ + Client *c, *mtail = selmon->clients, *stail = NULL, *insertafter; + int transfertostack = 0, i, nmasterclients; + + for (i = 0, c = selmon->clients; c; c = c->next) { + if (!ISVISIBLE(c) || c->isfloating) continue; + if (selmon->sel == c) { transfertostack = i < selmon->nmaster && selmon->nmaster != 0; } + if (i < selmon->nmaster) { nmasterclients++; mtail = c; } + stail = c; + i++; + } + if (selmon->sel->isfloating || i == 0) { + return; + } else if (transfertostack) { + selmon->nmaster = MIN(i, selmon->nmaster) - 1; + insertafter = stail; + } else { + selmon->nmaster = selmon->nmaster + 1; + insertafter = mtail; + } + if (insertafter != selmon->sel) { + detach(selmon->sel); + if (selmon->nmaster == 1 && !transfertostack) { + attach(selmon->sel); // Head prepend case + } else { + selmon->sel->next = insertafter->next; + insertafter->next = selmon->sel; + } + } + arrange(selmon); +}
\ No newline at end of file |
