From 522fdcd15de906ffd86ae868f5eb0905812b908a Mon Sep 17 00:00:00 2001 From: V Date: Sat, 28 Oct 2023 23:51:04 +0200 Subject: [PATCH] WebKeyBinds: Fix & make available on ArmCord --- .../index.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) rename src/plugins/{webKeybinds.vencordDesktop => webKeybinds.web}/index.ts (84%) diff --git a/src/plugins/webKeybinds.vencordDesktop/index.ts b/src/plugins/webKeybinds.web/index.ts similarity index 84% rename from src/plugins/webKeybinds.vencordDesktop/index.ts rename to src/plugins/webKeybinds.web/index.ts index 798713d50..12d485aac 100644 --- a/src/plugins/webKeybinds.vencordDesktop/index.ts +++ b/src/plugins/webKeybinds.web/index.ts @@ -18,19 +18,14 @@ import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { findLazy, mapMangledModuleLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { ComponentDispatch, FluxDispatcher, NavigationRouter, SelectedGuildStore, SettingsRouter } from "@webpack/common"; -const GuildNavBinds = mapMangledModuleLazy("mod+alt+down", { - CtrlTab: m => m.binds?.at(-1) === "ctrl+tab", - CtrlShiftTab: m => m.binds?.at(-1) === "ctrl+shift+tab", -}); - -const DigitBinds = findLazy(m => m.binds?.[0] === "mod+1"); +const KeyBinds = findByPropsLazy("JUMP_TO_GUILD", "SERVER_NEXT"); export default definePlugin({ name: "WebKeybinds", - description: "Re-adds keybinds missing in the web version of Discord: ctrl+t, ctrl+shift+t, ctrl+tab, ctrl+shift+tab, ctrl+1-9, ctrl+,", + description: "Re-adds keybinds missing in the web version of Discord: ctrl+t, ctrl+shift+t, ctrl+tab, ctrl+shift+tab, ctrl+1-9, ctrl+,. Only works fully on Vesktop/ArmCord, not inside your browser", authors: [Devs.Ven], enabledByDefault: true, @@ -57,13 +52,13 @@ export default definePlugin({ SettingsRouter.open("My Account"); break; case "Tab": - const handler = e.shiftKey ? GuildNavBinds.CtrlShiftTab : GuildNavBinds.CtrlTab; + const handler = e.shiftKey ? KeyBinds.SERVER_PREV : KeyBinds.SERVER_NEXT; handler.action(e); break; default: if (e.key >= "1" && e.key <= "9") { e.preventDefault(); - DigitBinds.action(e, `mod+${e.key}`); + KeyBinds.JUMP_TO_GUILD.action(e, `mod+${e.key}`); } break; }