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 | |
| parent | 60209c98d773c37e4def81e5334fa159d86fac45 (diff) | |
| download | dwm-flexipatch-84b0361b65ab17d1b167ad9dbfcab0524ef4bfde.tar.gz dwm-flexipatch-84b0361b65ab17d1b167ad9dbfcab0524ef4bfde.zip | |
Adding transfer patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 | ||||
| -rw-r--r-- | patch/transfer.c | 33 | ||||
| -rw-r--r-- | patch/transfer.h | 1 |
4 files changed, 40 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index 2e9cbf2..1fbc504 100644 --- a/patch/include.c +++ b/patch/include.c @@ -120,6 +120,9 @@ #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.c" #endif +#if TRANSFER_PATCH +#include "transfer.c" +#endif #if UNFLOATVISIBLE_PATCH #include "unfloatvisible.c" #endif diff --git a/patch/include.h b/patch/include.h index 06f4f0a..efe0917 100644 --- a/patch/include.h +++ b/patch/include.h @@ -120,6 +120,9 @@ #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.h" #endif +#if TRANSFER_PATCH +#include "transfer.h" +#endif #if UNFLOATVISIBLE_PATCH #include "unfloatvisible.h" #endif 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 diff --git a/patch/transfer.h b/patch/transfer.h new file mode 100644 index 0000000..a8436dd --- /dev/null +++ b/patch/transfer.h @@ -0,0 +1 @@ +static void transfer(const Arg *arg);
\ No newline at end of file |
