Skip to content

Commit

Permalink
clean out menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mligtenberg committed Jan 12, 2025
1 parent de10f6d commit aae7068
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/servicebus-browser-app/src/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BrowserWindow, shell, screen } from 'electron';
import { BrowserWindow, shell, screen, Menu } from 'electron';
import { rendererAppName, rendererAppPort } from './constants';
import { environment } from '../environments/environment';
import { join } from 'path';
import { format } from 'url';
import { menu } from './menu';

export default class App {
// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -79,6 +80,7 @@ export default class App {

// if main window is ready to show, close the splash window and show the main window
App.mainWindow.once('ready-to-show', () => {
Menu.setApplicationMenu(menu);
App.mainWindow.show();
});

Expand Down
34 changes: 34 additions & 0 deletions apps/servicebus-browser-app/src/app/menu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { app, Menu, MenuItemConstructorOptions, MenuItem } from 'electron'

const isMac = process.platform === 'darwin';

const macTemplate: Array<MenuItemConstructorOptions | MenuItem> = [
// { role: 'appMenu' }
{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'quit' }
]
},
// { role: 'fileMenu' }
{
label: 'File',
submenu: [
{ role: 'close' }
]
}
];

const winlinTemplate: Array<MenuItemConstructorOptions | MenuItem> = [
// { role: 'fileMenu' }
{
label: 'File',
submenu: [
{ role: 'quit' }
]
}
];

export const menu = Menu.buildFromTemplate(isMac ? macTemplate : winlinTemplate);

0 comments on commit aae7068

Please sign in to comment.