WebKeybinds: Re-add missing CTRL+, keybind (#4555)
This commit is contained in:
parent
991535e776
commit
0723d49f5c
1 changed files with 21 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs, IS_MAC } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { SettingsRouter } from "@webpack/common";
|
||||
|
||||
|
||||
const settings = definePluginSettings({
|
||||
|
|
@ -64,6 +65,26 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
|
||||
start() {
|
||||
document.addEventListener("keydown", this.onKey);
|
||||
},
|
||||
|
||||
stop() {
|
||||
document.removeEventListener("keydown", this.onKey);
|
||||
},
|
||||
|
||||
onKey(e: KeyboardEvent) {
|
||||
const hasCtrl = e.ctrlKey || (e.metaKey && IS_MAC);
|
||||
|
||||
// Cmd+, is a native shortcut on macos (Vesktop/src/main/mainWindow.ts)
|
||||
const hasNativeShortcut = IS_VESKTOP && IS_MAC;
|
||||
|
||||
if (hasCtrl && e.key === "," && !hasNativeShortcut) {
|
||||
e.preventDefault();
|
||||
SettingsRouter.openUserSettings();
|
||||
}
|
||||
},
|
||||
|
||||
getBlockedKeybinds() {
|
||||
// Zoom shortcuts, allowing these would cause unpredictable zooming behavior on macos
|
||||
const blocked: string[] = ["mod+plus", "mod+minus", "mod+0"];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue