From bc8fe97c133d33aa49f85fae1c8bea97434e37da Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 17 Feb 2026 13:07:43 -0500 Subject: [PATCH] launcher: fix kb navigation not always showing last delegate in view --- .../DankLauncherV2/NavigationHelpers.js | 6 +++++ .../Modals/DankLauncherV2/ResultsList.qml | 23 +++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/quickshell/Modals/DankLauncherV2/NavigationHelpers.js b/quickshell/Modals/DankLauncherV2/NavigationHelpers.js index d5300e10..1e78b11a 100644 --- a/quickshell/Modals/DankLauncherV2/NavigationHelpers.js +++ b/quickshell/Modals/DankLauncherV2/NavigationHelpers.js @@ -81,6 +81,12 @@ function calculateNextIndex(flatModel, selectedFlatIndex, sectionId, viewMode, g return bounds.start + newPosInSection; } + var currentRow = Math.floor(posInSection / cols); + var lastRow = Math.floor((bounds.count - 1) / cols); + if (currentRow < lastRow) { + return bounds.start + bounds.count - 1; + } + var nextSection = findNextNonHeaderIndex(flatModel, bounds.end + 1); return nextSection !== -1 ? nextSection : selectedFlatIndex; } diff --git a/quickshell/Modals/DankLauncherV2/ResultsList.qml b/quickshell/Modals/DankLauncherV2/ResultsList.qml index b3d4b937..b36386cb 100644 --- a/quickshell/Modals/DankLauncherV2/ResultsList.qml +++ b/quickshell/Modals/DankLauncherV2/ResultsList.qml @@ -130,24 +130,17 @@ Item { if (!entry || entry.isHeader) return; var rowIndex = _flatIndexToRowMap[index]; - if (rowIndex === undefined || rowIndex >= _cumulativeHeights.length) - return; - var row = _visualRows[rowIndex]; - if (!row) + if (rowIndex === undefined) return; - var rowY = _cumulativeHeights[rowIndex]; - var rowHeight = row.height; - var scrollY = mainListView.contentY - mainListView.originY; - var viewHeight = mainListView.height; - var headerH = stickyHeader.height; + mainListView.positionViewAtIndex(rowIndex, ListView.Contain); - 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; + if (stickyHeader.visible && rowIndex < _cumulativeHeights.length) { + var rowY = _cumulativeHeights[rowIndex]; + var scrollY = mainListView.contentY - mainListView.originY; + if (rowY < scrollY + stickyHeader.height) { + mainListView.contentY = Math.max(mainListView.originY, rowY - stickyHeader.height + mainListView.originY); + } } }