Prevent alt from focusing the menu bar

This commit is contained in:
x3rt 2023-07-02 17:23:17 -06:00
parent 843b57e03e
commit 5ea319e173
3 changed files with 14 additions and 1 deletions

View file

@ -37,7 +37,8 @@ export default function SettingsUi() {
"Open Links in app (experimental)", "Open Links in app (experimental)",
"Opens links in a new Vencord Desktop window instead of your web browser" "Opens links in a new Vencord Desktop window instead of your web browser"
], ],
["staticTitle", "Static Title", 'Makes the window title "Vencord" instead of changing to the current page'] ["staticTitle", "Static Title", 'Makes the window title "Vencord" instead of changing to the current page'],
["disableAltMenu", "Disable Alt Menu", "Prevent pressing Alt from showing the menu bar", true]
]; ];
return ( return (

View file

@ -10,6 +10,8 @@ import { waitFor } from "@vencord/types/webpack";
import { isFirstRun, localStorage } from "./utils"; import { isFirstRun, localStorage } from "./utils";
import { Settings } from "./settings";
// Make clicking Notifications focus the window // Make clicking Notifications focus the window
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!; const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
Object.defineProperty(Notification.prototype, "onclick", { Object.defineProperty(Notification.prototype, "onclick", {
@ -31,3 +33,12 @@ if (isFirstRun) {
m.setDesktopType("all"); m.setDesktopType("all");
}); });
} }
// Prevent pressing Alt from opening the menu bar
document.addEventListener("keyup", e => {
console.log(e);
if (e.key !== "Alt") return;
if (!Settings.store.disableAltMenu) return;
e.preventDefault();
});

View file

@ -18,6 +18,7 @@ export interface Settings {
minimizeToTray?: boolean; minimizeToTray?: boolean;
skippedUpdate?: string; skippedUpdate?: string;
staticTitle?: boolean; staticTitle?: boolean;
disableAltMenu?: boolean;
arRPC?: boolean; arRPC?: boolean;
appBadge?: boolean; appBadge?: boolean;