1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-14 18:27:44 +02:00

MacOS: Resolves #9488: Add "Window" menu to toolbar on MacOS (#9859)

This commit is contained in:
Henry Heino 2024-02-06 08:19:52 -08:00 committed by GitHub
parent 0e8f0a2dc1
commit e462881502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 3 deletions

View File

@ -20,6 +20,8 @@ const getLabel = (commandName: string): string => {
return _('Website and documentation');
case 'hideApp':
return _('Hide Joplin');
case 'minimizeWindow':
return _('Minimise');
case 'closeWindow':
return _('Close Window');
case 'config':

View File

@ -843,6 +843,24 @@ function useMenu(props: Props) {
label: _('&Tools'),
submenu: toolsItems,
},
window: {
id: 'window',
// Adds the default MacOS actions (e.g. "tile left") to the menu.
//
// Note: If the dev tools are shown on startup, this adds additional tab-related
// actions to the menu that are not otherwise shown. See https://stackoverflow.com/a/77458809
role: 'windowMenu',
label: _('&Window'),
visible: !!shim.isMac(),
submenu: [
{
role: 'minimize',
accelerator: shim.isMac() && keymapService.getAccelerator('minimizeWindow'),
},
],
},
help: {
label: _('&Help'),
role: 'help', // Makes it add the "Search" field on macOS
@ -946,6 +964,7 @@ function useMenu(props: Props) {
}
const template = [
shim.isMac() ? rootMenus.macOsApp : null,
rootMenus.file,
rootMenus.edit,
rootMenus.view,
@ -953,10 +972,9 @@ function useMenu(props: Props) {
rootMenus.folder,
rootMenus.note,
rootMenus.tools,
shim.isMac() ? rootMenus.window : null,
rootMenus.help,
];
if (shim.isMac()) template.splice(0, 0, rootMenus.macOsApp);
].filter(item => item !== null);
if (props.routeName !== 'Main') {
setMenu(Menu.buildFromTemplate([

View File

@ -20,6 +20,7 @@ const defaultKeymapItems = {
{ accelerator: 'Cmd+Q', command: 'quit' },
{ accelerator: 'Cmd+,', command: 'config' },
{ accelerator: 'Cmd+W', command: 'closeWindow' },
{ accelerator: 'Cmd+M', command: 'minimizeWindow' },
{ accelerator: 'Cmd+C', command: 'textCopy' },
{ accelerator: 'Cmd+X', command: 'textCut' },
{ accelerator: 'Cmd+V', command: 'textPaste' },