From 7c84ae17891e2c3c001f771b7fcb231469e8d76d Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Thu, 12 Sep 2024 23:50:39 +0900
Subject: [PATCH] Remove unused menu
---
main/background.ts | 5 ++-
main/menu.ts | 77 ++++++++++++++++++++++++++++++++++++++++++
renderer/next-env.d.ts | 2 +-
3 files changed, 82 insertions(+), 2 deletions(-)
create mode 100644 main/menu.ts
diff --git a/main/background.ts b/main/background.ts
index dba2580a..dffc3a10 100644
--- a/main/background.ts
+++ b/main/background.ts
@@ -1,7 +1,8 @@
import path from 'path'
-import { app, ipcMain, shell, IpcMainInvokeEvent, BrowserWindow } from 'electron'
+import { app, ipcMain, shell, IpcMainInvokeEvent, BrowserWindow, Menu } from 'electron'
import serve from 'electron-serve'
import { createWindow } from './helpers'
+import { menu } from './menu'
const isProd = process.env.NODE_ENV === 'production'
@@ -16,6 +17,8 @@ let main: BrowserWindow = null
;(async () => {
await app.whenReady()
+ Menu.setApplicationMenu(menu)
+
const mainWindow = createWindow('main', {
width: 1000,
height: 600,
diff --git a/main/menu.ts b/main/menu.ts
new file mode 100644
index 00000000..574ab238
--- /dev/null
+++ b/main/menu.ts
@@ -0,0 +1,77 @@
+import { app, Menu, MenuItem, MenuItemConstructorOptions } from 'electron'
+
+const isDarwin = () => process.platform === 'darwin'
+
+const template: Array = [
+ ...(isDarwin()
+ ? ([
+ {
+ label: app.name,
+ submenu: [
+ { role: 'about' },
+ { type: 'separator' },
+ { role: 'services' },
+ { type: 'separator' },
+ { role: 'hide' },
+ { role: 'hideOthers' },
+ { role: 'unhide' },
+ { type: 'separator' },
+ { role: 'quit' }
+ ]
+ }
+ ] as Array)
+ : ([] as Array