From 87f00ab5e964f90120a18a9eddacba4cbfc2d3ca Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 16 Jun 2026 13:30:52 +0800 Subject: [PATCH] fix: dwindle refuse arrange when restore from tty in non-selmon dwindle relies on sel window cutting, but the sel window has been cleared when the display is destroyed and was not set when the display is created --- src/layout/dwindle.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/layout/dwindle.h b/src/layout/dwindle.h index 74e79477..9562b5d8 100644 --- a/src/layout/dwindle.h +++ b/src/layout/dwindle.h @@ -565,6 +565,7 @@ void dwindle(Monitor *m) { break; } + // 清理树中已不存在的客户端 { DwindleNode *leaves[512]; int32_t lc = 0; @@ -602,9 +603,14 @@ void dwindle(Monitor *m) { } } + // 获得焦点客户端,若为空则用第一个可见平铺客户端兜底 Client *focused = focustop(m); if (focused && !dwindle_find_leaf(*root, focused)) focused = m->sel; + + if (!focused && count > 0) + focused = vis[0]; + for (int32_t i = 0; i < count; i++) { if (!dwindle_find_leaf(*root, vis[i])) dwindle_insert_with_config(root, vis[i], focused, ratio);