From cb461488ca94c0a97eb657b537bc05541cadb454 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Fri, 5 Jun 2026 16:01:33 -0700 Subject: [PATCH] slab(menubar): tiling ignores minimized Terminal windows windowCount + tileNow both filter `windows whose miniaturized is false` for Terminal, so a minimized window no longer inflates the grid (smaller cells) or gets shuffled into a wasted tile. iTerm2 doesn't expose `miniaturized` via AppleScript, so it still counts all its windows. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Sources/SlabMenubar/AppDelegate.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/slab/menubar-swift/Sources/SlabMenubar/AppDelegate.swift b/slab/menubar-swift/Sources/SlabMenubar/AppDelegate.swift index 78d4a44bb0..957dbedabf 100644 --- a/slab/menubar-swift/Sources/SlabMenubar/AppDelegate.swift +++ b/slab/menubar-swift/Sources/SlabMenubar/AppDelegate.swift @@ -1619,9 +1619,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { } if nTerm > 0 { lines.append("tell application \"Terminal\"") + // Tile only non-minimized windows (matches windowCount): a + // minimized window must neither consume a cell nor be moved. + lines.append(" set _slabVis to (every window whose miniaturized is false)") for j in 0.. Int { let spec = appSpecifier(app) + // Terminal exposes `miniaturized`, so minimized windows are excluded + // from the tile grid (they shouldn't consume a cell). iTerm2 doesn't + // expose it via AppleScript, so fall back to counting all windows. + let countExpr = app == "iTerm2" + ? "count windows" + : "count (windows whose miniaturized is false)" let script = """ if \(spec) is running then - tell \(spec) to count windows + tell \(spec) to \(countExpr) else 0 end if -- 2.51.2