mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-07 19:54:50 +00:00
Add cfact-snail patch
This commit is contained in:
parent
667c0fbdbe
commit
955e7dec32
13
patches/cfact-snail/README.md
Normal file
13
patches/cfact-snail/README.md
Normal file
@ -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))
|
68
patches/cfact-snail/cfact-snail.patch
Normal file
68
patches/cfact-snail/cfact-snail.patch
Normal file
@ -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
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user