From be1643c5b8529b4217e33ac21555c706015c8cca Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 4 Sep 2025 17:14:54 -0400 Subject: [PATCH] SettingsPanel: added keyboard navigation (Tab, Vim, Up/Down) to change active tab. --- Modules/SettingsPanel/SettingsPanel.qml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index c6d539b..2c38155 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -217,11 +217,63 @@ NPanel { root.currentTabIndex = initialIndex } + // Add navigation functions + function selectNextTab() { + if (tabsModel.length > 0) { + currentTabIndex = (currentTabIndex + 1) % tabsModel.length + } + } + + function selectPreviousTab() { + if (tabsModel.length > 0) { + currentTabIndex = (currentTabIndex - 1 + tabsModel.length) % tabsModel.length + } + } + panelContent: Rectangle { anchors.fill: parent anchors.margins: Style.marginL * scaling color: Color.transparent + // Add shortcuts at the panel level + Shortcut { + sequence: "Ctrl+J" + onActivated: root.selectNextTab() + enabled: root.opened + } + + Shortcut { + sequence: "Ctrl+K" + onActivated: root.selectPreviousTab() + enabled: root.opened + } + + // Optional: Add more navigation shortcuts + Shortcut { + sequence: "Down" + onActivated: root.selectNextTab() + enabled: root.opened + } + + Shortcut { + sequence: "Up" + onActivated: root.selectPreviousTab() + enabled: root.opened + } + + // Optional: Tab/Shift+Tab navigation + Shortcut { + sequence: "Tab" + onActivated: root.selectNextTab() + enabled: root.opened + } + + Shortcut { + sequence: "Shift+Tab" + onActivated: root.selectPreviousTab() + enabled: root.opened + } + RowLayout { anchors.fill: parent spacing: Style.marginM * scaling