launcher: fit grid rows in every host and drop the island inset literal

Port 2.0
This commit is contained in:
purian23 committed 2026-10-28 16:29:50 -04:00
1 parent 2af1c4c1a0
commit ff1bccbe7b
5 files changed
+12 -17

No files matched your search

@@ -41,9 +41,8 @@ Singleton {
readonly property real spotlightWidth: Theme.launcherWidthWide
readonly property real spotlightTopFraction: 0.33
readonly property real spotlightInset: Theme.spacingM
readonly property real islandBottomInset: 18
// The footerless island sheet ends in ResultsList's spacingS plus its bottom inset, not spacingM.
readonly property real islandEdgeInset: islandBottomInset + Theme.spacingS - Theme.spacingM
// The footerless island sheet adds ResultsList's spacingS below its spacingM margin.
readonly property real islandEdgeInset: Theme.spacingS
FontMetrics {
id: tileLabelMetrics
@@ -675,7 +675,6 @@ FocusScope {
focusReturnTarget: searchField
keyForwardTargets: [root]
anchors.fill: parent
fitGridRows: true
resizing: actionPanel.animating
controller: root.controller
leadingSectionHeaderAtBottom: contentHolder.inverted
@@ -34,9 +34,10 @@ Item {
readonly property int _densityLevel: Theme.densityLevel
readonly property int pageRows: Math.max(1, Math.floor((height - LauncherMetrics.fadeLength) / (LauncherMetrics.rowHeight + LauncherMetrics.rowGap)))
property real availableHeight: 0
property bool fitGridRows: false
// Set while the host animates height, so fitted cells settle once instead of every frame
property bool resizing: false
required property bool resizing
// Content-sized hosts follow fittedHeight, so their cells fit the budget rather than the current height
readonly property real _fitSpace: availableHeight > 0 ? availableHeight : height
readonly property real fittedHeight: {
const rows = _visualModel.rows;
const starts = _visualModel.heights;
@@ -132,8 +133,8 @@ Item {
var cols = root.controller?.getGridColumns(sectionId) ?? root.gridColumns;
var cellWidth = Math.floor(root.width / cols);
var cellHeight = mode === "tile" ? cellWidth * LauncherMetrics.tileImageRatio : cellWidth + LauncherMetrics.tileLabelHeight;
var gridSpace = root.height - sectionBand - LauncherMetrics.fadeLength;
if (root.fitGridRows && mode === "grid" && gridSpace > 0) {
var gridSpace = root._fitSpace - sectionBand - LauncherMetrics.fadeLength;
if (mode === "grid" && gridSpace > 0) {
// Never aim below what the icon and label need
var target = Math.max(cellHeight * LauncherMetrics.gridDensityScale, Math.min(cellHeight, LauncherMetrics.tileMinHeight));
cellHeight = gridSpace / Math.max(1, Math.round(gridSpace / target));
@@ -204,12 +205,12 @@ Item {
onGridColumnsChanged: rebuildTimer.restart()
onWidthChanged: rebuildTimer.restart()
onHeightChanged: _settleHeight()
on_FitSpaceChanged: _settleHeight()
onResizingChanged: _settleHeight()
// Only fitted grid cells depend on height
function _settleHeight() {
if (!fitGridRows || resizing)
if (resizing)
return;
if (_visualModel.hasGrid)
rebuildTimer.restart();
@@ -440,6 +440,7 @@ FocusScope {
keyForwardTargets: [searchKeyHandler]
readonly property real bottomInset: Theme.spacingS
availableHeight: Math.max(0, root._maxResultsH - root._resultsTopGap - bottomInset)
resizing: actionPanel.animating
anchors.fill: parent
anchors.topMargin: root._resultsTopGap
controller: root.controller
@@ -3,7 +3,6 @@ pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Modals.DLauncherV2
import qs.Modals.DLauncherV2.Components
FocusScope {
id: root
@@ -16,7 +15,6 @@ FocusScope {
property real screenHeight: effectiveScreen?.height ?? 1080
property real alignedX: 0
property real alignedY: 0
property real bottomInset: LauncherMetrics.islandBottomInset
clip: true
@@ -69,17 +67,14 @@ FocusScope {
id: launcherContent
anchors.fill: parent
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
anchors.topMargin: Theme.spacingM
anchors.bottomMargin: root.bottomInset
anchors.margins: Theme.spacingM
parentModal: hostContract
resultsInset: 0
controllerOverride: root.launcherController
transientSurfaceTracker: root.transientSurfaceTracker
showResultsWithoutQuery: true
resizeAnimated: false
maxResultsHeight: Math.max(120, root.controller.launcherExpandedTarget.height - Theme.spacingM - root.bottomInset - launcherContent.searchAreaHeight - launcherContent.actionPanelHeight)
maxResultsHeight: Math.max(120, root.controller.launcherExpandedTarget.height - Theme.spacingM * 2 - launcherContent.searchAreaHeight - launcherContent.actionPanelHeight)
}
onActiveFocusChanged: root.controller.launcherInputFocused = activeFocus