by default electron js has to show me the top menu when I touch the alt key, but I want to disable it but nothing works for me, I don't understand what to do Here is my code:
app.whenReady().then(() => {
createWindow();
mainWindow = getMainWindow();
autoUpdater.checkForUpdates();
mainWindow.webContents.send('update-info', `Checking for updates. Current version ${app.getVersion()}`);
globalShortcut.register('F11', () => {
console.log('F11 key is disabled');
});
globalShortcut.register('CommandOrControl+Alt', () => {
})
});
My expectation is that when I touch the alt key the menu will no longer appear
Alt
key pressed comes with the from your OS window management behavior,
There are two options you can do
OP 01:
Remove your menu entirely from your app , if you need any global shortcut you can add a custom logic.
Menu.setApplicationMenu(null);
globalShortcut.register('CommandOrControl+Alt', () => {
// add any logic
});
OP 02:
Build your custom Menu with behaviors
const menuTemplate = [
// add your labels and sub-menu with logics
];
const menu = Menu.buildFromTemplate(menuTemplate);
Menu.setApplicationMenu(menu);