WebKeybinds: Re-add missing CTRL+, keybind (#4555)

This commit is contained in:
Davri 2026-08-27 08:29:30 +02:00 • committed by GitHub
parent 991535e776
commit 0723d49f5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"];