From b565deda8d6bab7435689c9a964ba3586faaf0e7 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 12 Sep 2026 18:54:51 +0200 Subject: fix(window-switcher): clamp the card size by height too Only the width was clamped, so rows were free to run off the top and bottom of the screen. A centred Grid has no way to scroll to a card that lands there, so the cards were unreachable rather than merely cramped: at 19 windows on a 1080-tall screen the fourth row was clipped, and it grew worse from there. Cards now shrink to fit the available height as well, which leaves every count up to 18 exactly as it was, since the width term still wins there. Thirty windows fit in 995px. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SYg4wYHq5XNbiVmMeKRb1S --- window-switcher/Switcher.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/window-switcher/Switcher.qml b/window-switcher/Switcher.qml index 4d01b90..2e911b7 100644 --- a/window-switcher/Switcher.qml +++ b/window-switcher/Switcher.qml @@ -141,9 +141,20 @@ Scope { // Cards grow to fill their row, up to a ceiling. // Without the ceiling a lone preview becomes a // full-screen mirror of the window it stands for. + readonly property int rows: Math.ceil(count / columns) + + // The three text lines and the spacing above them, + // which the box height has to leave room for. + readonly property int textHeight: 54 + + // Clamped by the height as well as the width. Without + // the second term a busy desktop pushes rows off the + // top and bottom, and a centred Grid has no way to + // scroll to them, so the cards shrink instead. readonly property int cardWidth: Math.min( maxCardWidth, - Math.floor((parent.width * 0.92 - (columns - 1) * gap) / columns)) + Math.floor((parent.width * 0.92 - (columns - 1) * gap) / columns), + Math.floor(((parent.height * 0.92 - (rows - 1) * gap) / rows - textHeight) * 16 / 10)) spacing: gap -- cgit v1.2.3