From 0451b99ca14473c38789df7b7c899e62659608de Mon Sep 17 00:00:00 2001 From: quadbyte Date: Wed, 20 Aug 2025 21:02:32 -0400 Subject: [PATCH] AppLauncher keyboard control - added support for PageUp/Page Down - added support for (vim) Ctrl+J/Ctrl+K for up/dowm --- Modules/AppLauncher/AppLauncher.qml | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Modules/AppLauncher/AppLauncher.qml b/Modules/AppLauncher/AppLauncher.qml index e9dc0df..f50b108 100644 --- a/Modules/AppLauncher/AppLauncher.qml +++ b/Modules/AppLauncher/AppLauncher.qml @@ -142,6 +142,15 @@ NPanel { } } + function selectNextPage() { + if (filteredEntries.length > 0) + selectedIndex = Math.min(selectedIndex + 10, filteredEntries.length - 1) + } + function selectPrevPage() { + if (filteredEntries.length > 0) + selectedIndex = Math.max(selectedIndex - 10, 0) + } + function activateSelected() { if (filteredEntries.length === 0) return @@ -239,6 +248,7 @@ NPanel { Component.onCompleted: { // Focus the search bar by default Qt.callLater(() => { + selectedIndex = 0 searchInput.forceActiveFocus() }) } @@ -247,6 +257,27 @@ NPanel { Keys.onEnterPressed: activateSelected() Keys.onReturnPressed: activateSelected() Keys.onEscapePressed: root.close() + Keys.onPressed: event => { + if (event.key === Qt.Key_PageDown) { + root.selectNextPage() + event.accepted = true + } else if (event.key === Qt.Key_PageUp) { + root.selectPrevPage() + event.accepted = true + } + if (event.modifiers & Qt.ControlModifier) { + switch (event.key) { + case Qt.Key_J: + root.selectNext() + event.accepted = true + break + case Qt.Key_K: + root.selectPrev() + event.accepted = true + break + } + } + } } }