From cdb70fadb34f1d79155c199b25c382d2ce601932 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 12 Feb 2026 22:41:40 -0500 Subject: [PATCH] launcher v2: fix kb navigation to top of scroll --- .../Modals/DankLauncherV2/ResultsList.qml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/quickshell/Modals/DankLauncherV2/ResultsList.qml b/quickshell/Modals/DankLauncherV2/ResultsList.qml index 9a3ca99d..b3d4b937 100644 --- a/quickshell/Modals/DankLauncherV2/ResultsList.qml +++ b/quickshell/Modals/DankLauncherV2/ResultsList.qml @@ -130,9 +130,25 @@ Item { if (!entry || entry.isHeader) return; var rowIndex = _flatIndexToRowMap[index]; - if (rowIndex === undefined) + if (rowIndex === undefined || rowIndex >= _cumulativeHeights.length) return; - mainListView.positionViewAtIndex(rowIndex, ListView.Contain); + var row = _visualRows[rowIndex]; + if (!row) + return; + + var rowY = _cumulativeHeights[rowIndex]; + var rowHeight = row.height; + var scrollY = mainListView.contentY - mainListView.originY; + var viewHeight = mainListView.height; + var headerH = stickyHeader.height; + + if (rowY < scrollY + headerH) { + mainListView.contentY = Math.max(mainListView.originY, rowY - headerH + mainListView.originY); + return; + } + if (rowY + rowHeight > scrollY + viewHeight) { + mainListView.contentY = rowY + rowHeight - viewHeight + mainListView.originY; + } } function getSelectedItemPosition() {