launcher: add optional vim-like keybinds (#282)

This commit is contained in:
Joel R. 2025-07-28 05:08:54 +02:00 committed by GitHub
parent 9c99a537d0
commit 4feeaaabc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View file

@ -181,6 +181,7 @@ All configuration options are in `~/.config/caelestia/shell.json`.
"launcher": { "launcher": {
"actionPrefix": ">", "actionPrefix": ">",
"dragThreshold": 50, "dragThreshold": 50,
"vimKeybinds": false,
"enableDangerousActions": false, "enableDangerousActions": false,
"maxShown": 8, "maxShown": 8,
"maxWallpapers": 9, "maxWallpapers": 9,

View file

@ -7,6 +7,7 @@ JsonObject {
property string actionPrefix: ">" property string actionPrefix: ">"
property bool enableDangerousActions: false // Allow actions that can cause losing data, like shutdown, reboot and logout property bool enableDangerousActions: false // Allow actions that can cause losing data, like shutdown, reboot and logout
property int dragThreshold: 50 property int dragThreshold: 50
property bool vimKeybinds: false
property UseFuzzy useFuzzy: UseFuzzy {} property UseFuzzy useFuzzy: UseFuzzy {}
property Sizes sizes: Sizes {} property Sizes sizes: Sizes {}

View file

@ -102,6 +102,27 @@ Item {
Keys.onEscapePressed: root.visibilities.launcher = false 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 { Connections {
target: root.visibilities target: root.visibilities