From 4feeaaabc68dd3fca32222db555dc9b9d670f913 Mon Sep 17 00:00:00 2001 From: "Joel R." <59534812+h0useofdupree@users.noreply.github.com> Date: Mon, 28 Jul 2025 05:08:54 +0200 Subject: launcher: add optional vim-like keybinds (#282) --- README.md | 1 + config/LauncherConfig.qml | 1 + modules/launcher/Content.qml | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 52fa61d..42d973a 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ All configuration options are in `~/.config/caelestia/shell.json`. "launcher": { "actionPrefix": ">", "dragThreshold": 50, + "vimKeybinds": false, "enableDangerousActions": false, "maxShown": 8, "maxWallpapers": 9, diff --git a/config/LauncherConfig.qml b/config/LauncherConfig.qml index 70465a0..9364b91 100644 --- a/config/LauncherConfig.qml +++ b/config/LauncherConfig.qml @@ -7,6 +7,7 @@ JsonObject { property string actionPrefix: ">" property bool enableDangerousActions: false // Allow actions that can cause losing data, like shutdown, reboot and logout property int dragThreshold: 50 + property bool vimKeybinds: false property UseFuzzy useFuzzy: UseFuzzy {} property Sizes sizes: Sizes {} diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index e887bf9..0c41456 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -102,6 +102,27 @@ Item { Keys.onEscapePressed: root.visibilities.launcher = false + Keys.onPressed: event => { + if (!Config.launcher.vimKeybinds) + return; + + if (event.modifiers & Qt.ControlModifier) { + if (event.key === Qt.Key_J) { + list.currentList?.incrementCurrentIndex(); + event.accepted = true; + } else if (event.key === Qt.Key_K) { + list.currentList?.decrementCurrentIndex(); + event.accepted = true; + } + } else if (event.key === Qt.Key_Tab) { + list.currentList?.incrementCurrentIndex(); + event.accepted = true; + } else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier))) { + list.currentList?.decrementCurrentIndex(); + event.accepted = true; + } + } + Connections { target: root.visibilities -- cgit v1.2.3-freya