diff options
author | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
commit | c70505d7c7b7b48600f273357694b56ccf5d2a15 (patch) | |
tree | 21c27ac6ffced8d6d904e35bdb39baa5d685d829 /dwl-patches/patches/cfact-snail | |
download | dotfiles-master.tar.gz dotfiles-master.tar.bz2 dotfiles-master.zip |
Diffstat (limited to 'dwl-patches/patches/cfact-snail')
-rw-r--r-- | dwl-patches/patches/cfact-snail/README.md | 13 | ||||
-rw-r--r-- | dwl-patches/patches/cfact-snail/cfact-snail.patch | 68 |
2 files changed, 81 insertions, 0 deletions
diff --git a/dwl-patches/patches/cfact-snail/README.md b/dwl-patches/patches/cfact-snail/README.md new file mode 100644 index 0000000..488ab98 --- /dev/null +++ b/dwl-patches/patches/cfact-snail/README.md @@ -0,0 +1,13 @@ +### Description +This patch implements [cfact][cfact] for [snail][snail] layout. +This patch must be applied on top of cfact and snail patches. + +[cfact]: /dwl/dwl-patches/src/branch/main/patches/cfact +[snail]: /dwl/dwl-patches/src/branch/main/patches/snail + + +### Download + - [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/cfact-snail/cfact-snail.patch) + +### Authors +- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV)) diff --git a/dwl-patches/patches/cfact-snail/cfact-snail.patch b/dwl-patches/patches/cfact-snail/cfact-snail.patch new file mode 100644 index 0000000..213c3fd --- /dev/null +++ b/dwl-patches/patches/cfact-snail/cfact-snail.patch @@ -0,0 +1,68 @@ +From 9f8109182a7d173d2a2cb30c089a7e7b9ffe0a5e Mon Sep 17 00:00:00 2001 +From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com> +Date: Tue, 25 Mar 2025 02:24:32 +0100 +Subject: [PATCH] cfact patch for snail layout + +--- + dwl.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/dwl.c b/dwl.c +index 4f8c493..37aa935 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -2699,10 +2699,10 @@ snail(Monitor *m) + * Split the previous horizontally and put the current window on the right + */ + } else if (dir == WLR_DIRECTION_RIGHT) { +- c->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y, +- .width = prev->geom.width / 2, .height = prev->geom.height}; ++ c->geom = (struct wlr_box){.x = prev->geom.x + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .y = prev->geom.y, ++ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height}; + prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y, +- .width = prev->geom.width / 2, .height = prev->geom.height}; ++ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height}; + /* + * If it's a stack window or the first narrow window in the master + * area, put the next one below it +@@ -2713,28 +2713,28 @@ snail(Monitor *m) + * Split the previous vertically and put the current window below it + */ + } else if (dir == WLR_DIRECTION_DOWN) { +- c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2, +- .width = prev->geom.width, .height = prev->geom.height / 2}; ++ c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height), ++ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)}; + prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y, +- .width = prev->geom.width, .height = prev->geom.height / 2}; ++ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)}; + dir = WLR_DIRECTION_LEFT; + /* + * Split the previous horizontally and put the current window on the left + */ + } else if (dir == WLR_DIRECTION_LEFT) { + c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y, +- .width = prev->geom.width / 2, .height = prev->geom.height}; +- prev->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y, +- .width = prev->geom.width / 2, .height = prev->geom.height}; ++ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height}; ++ prev->geom = (struct wlr_box){.x = prev->geom.x + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .y = prev->geom.y, ++ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height}; + dir = WLR_DIRECTION_UP; + /* + * Split the previous vertically and put the current window above it + */ + } else { + c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y, +- .width = prev->geom.width, .height = prev->geom.height / 2}; +- prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2, +- .width = prev->geom.width, .height = prev->geom.height / 2}; ++ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)}; ++ prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height), ++ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)}; + dir = WLR_DIRECTION_RIGHT; + } + i++; +-- +2.49.0 + |