From 2539f7b68c19165d233fb4a2eab5dd27715988d7 Mon Sep 17 00:00:00 2001 From: "Joel R." <59534812+h0useofdupree@users.noreply.github.com> Date: Tue, 29 Jul 2025 04:48:51 +0200 Subject: session: add optional vim-like keybinds (#291) Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> --- README.md | 1 + config/SessionConfig.qml | 2 ++ modules/session/Content.qml | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/README.md b/README.md index fd26863..d1cc4fa 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,7 @@ All configuration options are in `~/.config/caelestia/shell.json`. }, "session": { "dragThreshold": 30, + "vimKeybinds": false, "commands": { "logout": ["loginctl", "terminate-user", ""], "shutdown": ["systemctl", "poweroff"], diff --git a/config/SessionConfig.qml b/config/SessionConfig.qml index e47f294..22b926c 100644 --- a/config/SessionConfig.qml +++ b/config/SessionConfig.qml @@ -3,7 +3,9 @@ import Quickshell.Io JsonObject { property bool enabled: true property int dragThreshold: 30 + property bool vimKeybinds: false property Commands commands: Commands{} + property Sizes sizes: Sizes {} component Commands: JsonObject { diff --git a/modules/session/Content.qml b/modules/session/Content.qml index d90c0bc..4c0bc88 100644 --- a/modules/session/Content.qml +++ b/modules/session/Content.qml @@ -98,6 +98,28 @@ Column { Keys.onEnterPressed: Quickshell.execDetached(button.command) Keys.onReturnPressed: Quickshell.execDetached(button.command) Keys.onEscapePressed: root.visibilities.session = false + Keys.onPressed: event => { + if (!Config.session.vimKeybinds) + return; + + if (event.modifiers & Qt.ControlModifier) { + if (event.key === Qt.Key_J && KeyNavigation.down) { + KeyNavigation.down.focus = true; + event.accepted = true; + } else if (event.key === Qt.Key_K && KeyNavigation.up) { + KeyNavigation.up.focus = true; + event.accepted = true; + } + } else if (event.key === Qt.Key_Tab && KeyNavigation.down) { + KeyNavigation.down.focus = true; + event.accepted = true; + } else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier))) { + if (KeyNavigation.up) { + KeyNavigation.up.focus = true; + event.accepted = true; + } + } + } StateLayer { radius: parent.radius -- cgit v1.2.3-freya