From c1d77003899e3a61cd7040a71db1ee09966a7f89 Mon Sep 17 00:00:00 2001 From: s0mesh1t <87767572+s0mesh1t@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:19:19 +0700 Subject: [PATCH 1/2] Tab now switches between APIs --- .config/ags/modules/sideleft/apiwidgets.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/ags/modules/sideleft/apiwidgets.js b/.config/ags/modules/sideleft/apiwidgets.js index 2d2b0e182..ae5a533a4 100644 --- a/.config/ags/modules/sideleft/apiwidgets.js +++ b/.config/ags/modules/sideleft/apiwidgets.js @@ -90,6 +90,12 @@ export const chatEntry = TextView({ self.placeholderText = (Gemini.key.length > 0 ? getString('Message Gemini...') : getString('Enter Google AI API Key...')); }, 'hasKey') .on("key-press-event", (widget, event) => { + // Переключение по Tab + if (event.get_keyval()[1] === Gdk.KEY_Tab) { + const nextId = (currentApiId + 1) % APIS.asyncGet().length; + switchToTab(nextId); + return true; + } // Don't send when Shift+Enter if (event.get_keyval()[1] === Gdk.KEY_Return || event.get_keyval()[1] === Gdk.KEY_KP_Enter) { if (event.get_state()[1] !== 17) {// SHIFT_MASK doesn't work but 17 should be shift From cac7b91b783cd46df80106fb35b8d9de28811833 Mon Sep 17 00:00:00 2001 From: s0mesh1t <87767572+s0mesh1t@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:39:03 +0700 Subject: [PATCH 2/2] switch APIs with tab now support reversed --- .config/ags/modules/sideleft/apiwidgets.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.config/ags/modules/sideleft/apiwidgets.js b/.config/ags/modules/sideleft/apiwidgets.js index ae5a533a4..20ce859e3 100644 --- a/.config/ags/modules/sideleft/apiwidgets.js +++ b/.config/ags/modules/sideleft/apiwidgets.js @@ -90,10 +90,12 @@ export const chatEntry = TextView({ self.placeholderText = (Gemini.key.length > 0 ? getString('Message Gemini...') : getString('Enter Google AI API Key...')); }, 'hasKey') .on("key-press-event", (widget, event) => { - // Переключение по Tab - if (event.get_keyval()[1] === Gdk.KEY_Tab) { - const nextId = (currentApiId + 1) % APIS.asyncGet().length; - switchToTab(nextId); + // Swtich APIs with Tab + const key = event.get_keyval()[1]; + if (key === Gdk.KEY_Tab || key === Gdk.KEY_ISO_Left_Tab) { + const dir = key === Gdk.KEY_Tab ? 1 : -1; + const newId = (currentApiId + dir + APIS.asyncGet().length) % APIS.asyncGet().length; + switchToTab(newId); return true; } // Don't send when Shift+Enter