diff --git a/app/src/electron.js b/app/src/electron.js index 87823b66..225efda0 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -49,12 +49,22 @@ autoUpdater.logger = log; let commands = {}; +function formatKeyText(keyText) { + if (!keyText) { + return keyText; + } + if (os.platform() == 'darwin') { + return keyText.replace('CtrlOrCommand+', 'Command+'); + } + return keyText; +} + function commandItem(id) { const command = commands[id]; return { id, label: command ? command.menuName || command.toolbarName || command.name : id, - accelerator: command ? command.keyText : undefined, + accelerator: formatKeyText(command ? command.keyText : undefined), enabled: command ? command.enabled : false, click() { mainWindow.webContents.send('run-command', id); @@ -86,7 +96,9 @@ ipcMain.on('update-commands', async (event, arg) => { // rebuild menu if (menu.label != command.text || menu.accelerator != command.keyText) { mainMenu = buildMenu(); - mainWindow.setMenu(mainMenu); + + Menu.setApplicationMenu(mainMenu); + // mainWindow.setMenu(mainMenu); return; } diff --git a/packages/web/src/commands/CommandListener.svelte b/packages/web/src/commands/CommandListener.svelte index 0e2ff05f..885de4b1 100644 --- a/packages/web/src/commands/CommandListener.svelte +++ b/packages/web/src/commands/CommandListener.svelte @@ -2,7 +2,7 @@ import { commandsCustomized, visibleCommandPalette } from '../stores'; import { get } from 'svelte/store'; import { runGroupCommand } from './runCommand'; -import { resolveKeyText } from '../utility/common'; + import { resolveKeyText } from '../utility/common'; export function handleCommandKeyDown(e) { let keyText = '';