diff options
| author | bakkeby <[email protected]> | 2020-05-01 16:45:25 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-05-01 16:45:25 +0200 |
| commit | b837899f7aff816895ae892f965be461c8b027ef (patch) | |
| tree | e30df5299ec9b5db4f9d582edae32bd00bcaf3be /patch | |
| parent | 0a0222d9290bfc660145d7a72d37c8c5e1328dd7 (diff) | |
| download | dwm-flexipatch-b837899f7aff816895ae892f965be461c8b027ef.tar.gz dwm-flexipatch-b837899f7aff816895ae892f965be461c8b027ef.zip | |
Adding option to be able to reverse cycle through flextile-deluxe layouts
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/flextile-deluxe.c | 33 | ||||
| -rw-r--r-- | patch/pertag.c | 2 |
2 files changed, 26 insertions, 9 deletions
diff --git a/patch/flextile-deluxe.c b/patch/flextile-deluxe.c index 6fade28..f96cc92 100644 --- a/patch/flextile-deluxe.c +++ b/patch/flextile-deluxe.c @@ -690,17 +690,34 @@ mirrorlayout(const Arg *arg) void rotatelayoutaxis(const Arg *arg) { + int incr = (arg->i > 0 ? 1 : -1); + int axis = abs(arg->i) - 1; + if (!selmon->lt[selmon->sellt]->arrange) return; - if (arg->i == 0) { - if (selmon->ltaxis[LAYOUT] >= 0) - selmon->ltaxis[LAYOUT] = selmon->ltaxis[LAYOUT] + 1 >= LAYOUT_LAST ? 0 : selmon->ltaxis[LAYOUT] + 1; - else - selmon->ltaxis[LAYOUT] = selmon->ltaxis[LAYOUT] - 1 <= -LAYOUT_LAST ? -0 : selmon->ltaxis[LAYOUT] - 1; - } else - selmon->ltaxis[arg->i] = selmon->ltaxis[arg->i] + 1 >= AXIS_LAST ? 0 : selmon->ltaxis[arg->i] + 1; + if (axis == LAYOUT) { + if (selmon->ltaxis[LAYOUT] >= 0) { + selmon->ltaxis[LAYOUT] += incr; + if (selmon->ltaxis[LAYOUT] >= LAYOUT_LAST) + selmon->ltaxis[LAYOUT] = 0; + else if (selmon->ltaxis[LAYOUT] < 0) + selmon->ltaxis[LAYOUT] = LAYOUT_LAST - 1; + } else { + selmon->ltaxis[LAYOUT] -= incr; + if (selmon->ltaxis[LAYOUT] <= -LAYOUT_LAST) + selmon->ltaxis[LAYOUT] = 0; + else if (selmon->ltaxis[LAYOUT] > 0) + selmon->ltaxis[LAYOUT] = -LAYOUT_LAST + 1; + } + } else { + selmon->ltaxis[axis] += incr; + if (selmon->ltaxis[axis] >= AXIS_LAST) + selmon->ltaxis[axis] = 0; + else if (selmon->ltaxis[axis] < 0) + selmon->ltaxis[axis] = AXIS_LAST - 1; + } #if PERTAG_PATCH - selmon->pertag->ltaxis[selmon->pertag->curtag][arg->i] = selmon->ltaxis[arg->i]; + selmon->pertag->ltaxis[selmon->pertag->curtag][axis] = selmon->ltaxis[axis]; #endif // PERTAG_PATCH arrange(selmon); setflexsymbols(selmon, 0); diff --git a/patch/pertag.c b/patch/pertag.c index 3b598ee..cc97a6c 100644 --- a/patch/pertag.c +++ b/patch/pertag.c @@ -36,7 +36,7 @@ pertagview(const Arg *arg) if (arg->ui == ~0) selmon->pertag->curtag = 0; else { - for (i=0; !(arg->ui & 1 << i); i++) ; + for (i = 0; !(arg->ui & 1 << i); i++) ; selmon->pertag->curtag = i + 1; } } else { |
