From f9bcbd588b8714e4e7490aa3478526c0331b04ac Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Tue, 3 Dec 2024 12:52:04 +0100 Subject: [PATCH] mac keyboard menu --- app/src/electron.js | 2 +- app/src/mainMenuDefinition.js | 36 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/src/electron.js b/app/src/electron.js index 8106380f3..fd1a8a3d5 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -108,7 +108,7 @@ function commandItem(item) { } function buildMenu() { - let template = _cloneDeepWith(mainMenuDefinition({ editMenu: true }), item => { + let template = _cloneDeepWith(mainMenuDefinition({ editMenu: true, isMac: isMac() }), item => { if (item.divider) { return { type: 'separator' }; } diff --git a/app/src/mainMenuDefinition.js b/app/src/mainMenuDefinition.js index bdb7aa878..de33984ec 100644 --- a/app/src/mainMenuDefinition.js +++ b/app/src/mainMenuDefinition.js @@ -1,4 +1,4 @@ -module.exports = ({ editMenu }) => [ +module.exports = ({ editMenu, isMac }) => [ { label: 'File', submenu: [ @@ -24,20 +24,6 @@ module.exports = ({ editMenu }) => [ { command: 'app.disconnect', hideDisabled: true, skipInApp: true }, ], }, - { - label: 'Window', - submenu: [ - { command: 'tabs.closeTab', hideDisabled: false }, - { command: 'tabs.closeAll', hideDisabled: false }, - { command: 'tabs.closeTabsWithCurrentDb', hideDisabled: false }, - { command: 'tabs.closeTabsButCurrentDb', hideDisabled: false }, - { divider: true }, - { command: 'app.zoomIn', hideDisabled: true }, - { command: 'app.zoomOut', hideDisabled: true }, - { command: 'app.zoomReset', hideDisabled: true }, - ], - }, - editMenu ? { label: 'Edit', @@ -75,6 +61,15 @@ module.exports = ({ editMenu }) => [ { divider: true }, { command: 'theme.changeTheme', hideDisabled: true }, { command: 'settings.show' }, + { divider: true }, + { command: 'tabs.closeTab', hideDisabled: false }, + { command: 'tabs.closeAll', hideDisabled: false }, + { command: 'tabs.closeTabsWithCurrentDb', hideDisabled: false }, + { command: 'tabs.closeTabsButCurrentDb', hideDisabled: false }, + { divider: true }, + { command: 'app.zoomIn', hideDisabled: true }, + { command: 'app.zoomOut', hideDisabled: true }, + { command: 'app.zoomReset', hideDisabled: true }, ], }, { @@ -94,6 +89,17 @@ module.exports = ({ editMenu }) => [ { command: 'app.resetSettings', hideDisabled: true }, ], }, + isMac + ? { + role: 'window', + submenu: [ + { role: 'minimize' }, + { role: 'zoom' }, + { type: 'separator' }, + { role: 'front' }, + ], + } + : null, { label: 'Help', submenu: [