diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-12 18:54:51 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-12 18:54:51 +0200 |
| commit | b565deda8d6bab7435689c9a964ba3586faaf0e7 (patch) | |
| tree | fa7caf70e609052532868dd6837dc5446edc6a18 /window-switcher | |
| parent | 0f3d2ebfb4aed4801548c29cb1e7fe52e9246a90 (diff) | |
| download | quickshell-b565deda8d6bab7435689c9a964ba3586faaf0e7.tar.gz quickshell-b565deda8d6bab7435689c9a964ba3586faaf0e7.zip | |
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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYg4wYHq5XNbiVmMeKRb1S
Diffstat (limited to 'window-switcher')
| -rw-r--r-- | window-switcher/Switcher.qml | 13 |
1 files changed, 12 insertions, 1 deletions
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 |
