Skip to content

Commit

Permalink
feat: add default mac menu bar items
Browse files Browse the repository at this point in the history
- Add default 'Window' menu
- Add help menu with links to github issues and wiki

Closes Xiphe#83
  • Loading branch information
leo-benz committed Nov 1, 2021
1 parent 85ac8dd commit c567af2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/useMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
createEditMenu,
createOpenRecent,
CreateMenuCallbacks,
createWindowMenu,
createHelpMenu,
} from '../shared/createMenu';
import { useRecentFiles } from './useRecentFiles';
import { RecentFile } from '../shared/settings';
Expand Down Expand Up @@ -60,6 +62,8 @@ function buildMenu(callbacks: CreateMenuCallbacks, recentFiles: RecentFile[]) {
entries: fileMenuEntries.concat(refreshEntry),
}),
createEditMenu(),
createWindowMenu(),
createHelpMenu()
],
callbacks,
),
Expand Down
36 changes: 35 additions & 1 deletion src/shared/createMenu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MenuItemConstructorOptions } from 'electron';
import { MenuItemConstructorOptions, shell } from 'electron';
import { basename } from 'path';
import { RecentFile } from './settings';

Expand Down Expand Up @@ -116,3 +116,37 @@ export function createEditMenu(): MenuConfig {
],
};
}

export function createWindowMenu(): MenuConfig {
return {
label: 'Window',
submenu: [
{
role: 'minimize',
accelerator: 'Command+M'
},
{ role: 'zoom' },
{ type: 'separator' },
{ role: 'front' }
],
role: 'window'
}
}

export function createHelpMenu(): MenuConfig {
return {
label: "Help",
submenu: [
{
label: 'Advanced Budget Input',
click: () => shell.openExternal('https://github.com/Xiphe/budgetbudget/wiki/BudgetInput')
},
{ type: 'separator'},
{
label: 'Report issue',
click: () => shell.openExternal('https://github.com/Xiphe/budgetbudget/issues')
},
],
role: 'help'
}
}

0 comments on commit c567af2

Please sign in to comment.