feat: reuse more built-in menus
This commit is contained in:
		
							parent
							
								
									a277f13291
								
							
						
					
					
						commit
						e1102e64a4
					
				
					 1 changed files with 8 additions and 46 deletions
				
			
		|  | @ -85,9 +85,11 @@ function initMenuBar(win: BrowserWindow) { | |||
|     const menu = Menu.buildFromTemplate([ | ||||
|         { | ||||
|             label: "Vencord Desktop", | ||||
|             role: "appMenu", | ||||
|             submenu: [ | ||||
|                 { | ||||
|                     label: "About Vencord Desktop", | ||||
|                     role: "about", | ||||
|                     click: createAboutWindow | ||||
|                 }, | ||||
|                 { | ||||
|  | @ -99,28 +101,6 @@ function initMenuBar(win: BrowserWindow) { | |||
|                     }, | ||||
|                     toolTip: "Vencord Desktop will automatically restart after this operation" | ||||
|                 }, | ||||
|                 { | ||||
|                     label: "Toggle Developer Tools", | ||||
|                     accelerator: "CmdOrCtrl+Shift+I", | ||||
|                     click() { | ||||
|                         BrowserWindow.getFocusedWindow()!.webContents.toggleDevTools(); | ||||
|                     } | ||||
|                 }, | ||||
|                 { | ||||
|                     label: "Toggle Developer Tools (Hidden)", | ||||
|                     accelerator: "F12", | ||||
|                     visible: false, | ||||
|                     click() { | ||||
|                         BrowserWindow.getFocusedWindow()!.webContents.toggleDevTools(); | ||||
|                     } | ||||
|                 }, | ||||
|                 { | ||||
|                     label: "Reload Window", | ||||
|                     accelerator: "CmdOrCtrl+R", | ||||
|                     click() { | ||||
|                         BrowserWindow.getFocusedWindow()!.webContents.reload(); | ||||
|                     } | ||||
|                 }, | ||||
|                 { | ||||
|                     label: "Relaunch", | ||||
|                     accelerator: "CmdOrCtrl+Shift+R", | ||||
|  | @ -133,6 +113,7 @@ function initMenuBar(win: BrowserWindow) { | |||
|                     label: "Quit", | ||||
|                     accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0, | ||||
|                     visible: !isWindows, | ||||
|                     role: "quit", | ||||
|                     click() { | ||||
|                         app.quit(); | ||||
|                     } | ||||
|  | @ -141,36 +122,17 @@ function initMenuBar(win: BrowserWindow) { | |||
|                     label: "Quit", | ||||
|                     accelerator: isWindows ? "Alt+F4" : void 0, | ||||
|                     visible: isWindows, | ||||
|                     role: "quit", | ||||
|                     click() { | ||||
|                         app.quit(); | ||||
|                     } | ||||
|                 } | ||||
|             ] | ||||
|         }, | ||||
|         ...(isMacOS ? [{ role: "editMenu" as const }] : []), | ||||
|         { | ||||
|             label: "Zoom", | ||||
|             submenu: [ | ||||
|                 { | ||||
|                     label: "Zoom in", | ||||
|                     accelerator: "CmdOrCtrl+Plus", | ||||
|                     role: "zoomIn" | ||||
|                 }, | ||||
|                 // Fix for zoom in on keyboards with dedicated + like QWERTZ (or numpad)
 | ||||
|                 // See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
 | ||||
|                 { | ||||
|                     label: "Zoom in", | ||||
|                     accelerator: "CmdOrCtrl+=", | ||||
|                     role: "zoomIn", | ||||
|                     visible: false | ||||
|                 }, | ||||
|                 { | ||||
|                     label: "Zoom out", | ||||
|                     accelerator: "CmdOrCtrl+-", | ||||
|                     role: "zoomOut" | ||||
|                 } | ||||
|             ] | ||||
|         } | ||||
|         { role: "fileMenu" }, | ||||
|         { role: "editMenu" }, | ||||
|         { role: "viewMenu" }, | ||||
|         { role: "windowMenu" } | ||||
|     ]); | ||||
| 
 | ||||
|     Menu.setApplicationMenu(menu); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Ryan Cao
						Ryan Cao