diff options
Diffstat (limited to 'window-switcher/Switcher.qml')
| -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 |
