mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 10:56:24 +02:00
refactor(desktop): extract menu setup into modules/menu.ts
This commit is contained in:
parent
d868464de7
commit
b6a7f0afa7
2 changed files with 15 additions and 13 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import { app, BrowserWindow, shell, ipcMain, Menu } from 'electron';
|
||||
import { app, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import { registerGlobalErrorHandlers, showErrorDialog } from './modules/errors';
|
||||
import { startNextServer } from './modules/server';
|
||||
import { createMainWindow } from './modules/window';
|
||||
import { setupDeepLinks, handlePendingDeepLink } from './modules/deep-links';
|
||||
import { setupAutoUpdater } from './modules/auto-updater';
|
||||
import { setupMenu } from './modules/menu';
|
||||
|
||||
registerGlobalErrorHandlers();
|
||||
|
||||
|
|
@ -27,18 +28,6 @@ ipcMain.handle('get-app-version', () => {
|
|||
return app.getVersion();
|
||||
});
|
||||
|
||||
function setupMenu() {
|
||||
const isMac = process.platform === 'darwin';
|
||||
const template: Electron.MenuItemConstructorOptions[] = [
|
||||
...(isMac ? [{ role: 'appMenu' as const }] : []),
|
||||
{ role: 'fileMenu' as const },
|
||||
{ role: 'editMenu' as const },
|
||||
{ role: 'viewMenu' as const },
|
||||
{ role: 'windowMenu' as const },
|
||||
];
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||
}
|
||||
|
||||
// App lifecycle
|
||||
app.whenReady().then(async () => {
|
||||
setupMenu();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue