hyper/app/menus/menus/darwin.ts

60 lines
1.2 KiB
TypeScript
Raw Normal View History

// This menu label is overrided by OSX to be the appName
// The label is set to appName here so it matches actual behavior
2023-06-26 01:29:50 -08:00
import {app} from 'electron';
2023-07-25 09:30:19 -08:00
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
2023-07-25 08:11:02 -08:00
const darwinMenu = (
2019-12-20 08:55:03 -09:00
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void,
showAbout: () => void
): MenuItemConstructorOptions => {
return {
label: `${app.name}`,
submenu: [
{
label: 'About Hyper',
click() {
showAbout();
}
},
{
type: 'separator'
},
{
label: 'Preferences...',
2017-11-03 13:06:48 -08:00
accelerator: commandKeys['window:preferences'],
click() {
execCommand('window:preferences');
}
},
{
type: 'separator'
},
{
role: 'services',
submenu: []
},
{
type: 'separator'
},
{
role: 'hide'
},
{
2019-12-20 08:55:03 -09:00
role: 'hideOthers'
},
{
role: 'unhide'
},
{
type: 'separator'
},
{
role: 'quit'
}
]
};
};
2023-07-25 08:11:02 -08:00
export default darwinMenu;