launcher: add optional vim-like keybinds (#282)
This commit is contained in:
parent
9c99a537d0
commit
4feeaaabc6
3 changed files with 23 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue