From b6e34a4ab139fd881dfc20ff2f78cbfd74cd9985 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:06:04 +0700 Subject: [PATCH] tab switching keybind for keybinds cheatsheet --- .config/ags/modules/cheatsheet/main.js | 13 ++++++++++++- .config/ags/modules/sideleft/sideleft.js | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.config/ags/modules/cheatsheet/main.js b/.config/ags/modules/cheatsheet/main.js index 4cc156aeb..815553a61 100644 --- a/.config/ags/modules/cheatsheet/main.js +++ b/.config/ags/modules/cheatsheet/main.js @@ -88,12 +88,13 @@ const SheetContent = (id) => { } export default (id) => { + const sheets = SheetContent(id); const widgetContent = Widget.Box({ vertical: true, className: "cheatsheet-bg spacing-v-5", children: [ CheatsheetHeader(), - SheetContent(id), + sheets, ] }); return PopupWindow({ @@ -121,6 +122,16 @@ export default (id) => { sheetContents[id].nextTab(); else if (checkKeybind(event, userOptions.keybinds.cheatsheet.prevTab)) sheetContents[id].prevTab(); + if (sheets.attribute.names[sheets.attribute.shown.value] == 'Keybinds') { // If Keybinds tab is focused + if (checkKeybind(event, userOptions.keybinds.cheatsheet.keybinds.nextTab)) { + const toSwitchTab = sheets.attribute.children[sheets.attribute.shown.value]; + toSwitchTab.nextTab(); + } + else if (checkKeybind(event, userOptions.keybinds.cheatsheet.keybinds.prevTab)) { + const toSwitchTab = sheets.attribute.children[sheets.attribute.shown.value]; + toSwitchTab.prevTab(); + } + } }) }) }); diff --git a/.config/ags/modules/sideleft/sideleft.js b/.config/ags/modules/sideleft/sideleft.js index 969cdf23f..a3cc9340f 100644 --- a/.config/ags/modules/sideleft/sideleft.js +++ b/.config/ags/modules/sideleft/sideleft.js @@ -108,11 +108,11 @@ export default () => Box({ // Switch API type else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.nextTab)) { const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value]; - toSwitchTab.attribute.nextTab(); + toSwitchTab.nextTab(); } else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.prevTab)) { const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value]; - toSwitchTab.attribute.prevTab(); + toSwitchTab.prevTab(); } }