From c151ad46e63ad07dff6026b065a2e02ce61a9ac7 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 13 Dec 2025 11:43:39 +0800 Subject: [PATCH] feat: add layout tgmix --- src/layout/arrange.h | 3 ++- src/layout/horizontal.h | 11 +++++++++++ src/layout/layout.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/layout/arrange.h b/src/layout/arrange.h index 3b52bd4..4a910aa 100644 --- a/src/layout/arrange.h +++ b/src/layout/arrange.h @@ -485,7 +485,8 @@ void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety, const Layout *current_layout = grabc->mon->pertag->ltidxs[grabc->mon->pertag->curtag]; if (current_layout->id == TILE || current_layout->id == DECK || - current_layout->id == CENTER_TILE || current_layout->id == RIGHT_TILE + current_layout->id == CENTER_TILE || current_layout->id == RIGHT_TILE || + (current_layout->id == TGMIX && grabc->mon->visible_tiling_clients <= 3) ) { resize_tile_master_horizontal(grabc, isdrag, offsetx, offsety, time, diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index ce6617d..a9d6248 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -840,4 +840,15 @@ monocle(Monitor *m) { } if ((c = focustop(m))) wlr_scene_node_raise_to_top(&c->scene->node); +} + +void tgmix(Monitor *m) { + uint32_t n = m->visible_tiling_clients; + if (n <= 3) { + tile(m); + return; + } else { + grid(m); + return; + } } \ No newline at end of file diff --git a/src/layout/layout.h b/src/layout/layout.h index 62a3227..169ab11 100644 --- a/src/layout/layout.h +++ b/src/layout/layout.h @@ -11,6 +11,7 @@ static void vertical_overview(Monitor *m); static void vertical_grid(Monitor *m); static void vertical_scroller(Monitor *m); static void vertical_deck(Monitor *mon); +static void tgmix(Monitor *m); /* layout(s) */ Layout overviewlayout = {"󰃇", overview, "overview"}; @@ -27,6 +28,7 @@ enum { VERTICAL_GRID, VERTICAL_DECK, RIGHT_TILE, + TGMIX, }; Layout layouts[] = { @@ -44,4 +46,5 @@ Layout layouts[] = { {"VT", vertical_tile, "vertical_tile", VERTICAL_TILE}, // 垂直平铺布局 {"VG", vertical_grid, "vertical_grid", VERTICAL_GRID}, // 垂直格子布局 {"VK", vertical_deck, "vertical_deck", VERTICAL_DECK}, // 垂直卡片布局 + {"TG", tgmix, "tgmix", TGMIX}, // 混合布局 }; \ No newline at end of file