You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			154 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			154 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
| const {Menu} = require('electron')
 | |
| 
 | |
| const template = [
 | |
|   {
 | |
|     label: 'Edit',
 | |
|     submenu: [
 | |
|       {
 | |
|         role: 'undo'
 | |
|       },
 | |
|       {
 | |
|         role: 'redo'
 | |
|       },
 | |
|       {
 | |
|         type: 'separator'
 | |
|       },
 | |
|       {
 | |
|         role: 'cut'
 | |
|       },
 | |
|       {
 | |
|         role: 'copy'
 | |
|       },
 | |
|       {
 | |
|         role: 'paste'
 | |
|       },
 | |
|       {
 | |
|         role: 'pasteandmatchstyle'
 | |
|       },
 | |
|       {
 | |
|         role: 'delete'
 | |
|       },
 | |
|       {
 | |
|         role: 'selectall'
 | |
|       }
 | |
|     ]
 | |
|   },
 | |
|   {
 | |
|     label: 'View',
 | |
|     submenu: [
 | |
|       {
 | |
|         role: 'reload'
 | |
|       },
 | |
|       {
 | |
|         role: 'forcereload'
 | |
|       },
 | |
|       {
 | |
|         role: 'toggledevtools'
 | |
|       },
 | |
|       {
 | |
|         type: 'separator'
 | |
|       },
 | |
|       {
 | |
|         role: 'resetzoom'
 | |
|       },
 | |
|       {
 | |
|         role: 'zoomin'
 | |
|       },
 | |
|       {
 | |
|         role: 'zoomout'
 | |
|       },
 | |
|       {
 | |
|         type: 'separator'
 | |
|       },
 | |
|       {
 | |
|         role: 'togglefullscreen'
 | |
|       }
 | |
|     ]
 | |
|   },
 | |
|   {
 | |
|     role: 'window',
 | |
|     submenu: [
 | |
|       {
 | |
|         role: 'minimize'
 | |
|       },
 | |
|       {
 | |
|         role: 'close'
 | |
|       }
 | |
|     ]
 | |
|   }
 | |
| ]
 | |
| 
 | |
| if (process.platform === 'darwin') {
 | |
|   template.unshift({
 | |
|     submenu: [
 | |
|       {
 | |
|         role: 'about'
 | |
|       },
 | |
|       {
 | |
|         type: 'separator'
 | |
|       },
 | |
|       {
 | |
|         role: 'hide'
 | |
|       },
 | |
|       {
 | |
|         role: 'hideothers'
 | |
|       },
 | |
|       {
 | |
|         role: 'unhide'
 | |
|       },
 | |
|       {
 | |
|         type: 'separator'
 | |
|       },
 | |
|       {
 | |
|         role: 'quit'
 | |
|       }
 | |
|     ]
 | |
|   })
 | |
|   // Edit menu.
 | |
|   template[1].submenu.push(
 | |
|     {
 | |
|       type: 'separator'
 | |
|     },
 | |
|     {
 | |
|       label: 'Speech',
 | |
|       submenu: [
 | |
|         {
 | |
|           role: 'startspeaking'
 | |
|         },
 | |
|         {
 | |
|           role: 'stopspeaking'
 | |
|         }
 | |
|       ]
 | |
|     }
 | |
|   )
 | |
|   // Window menu.
 | |
|   template[3].submenu = [
 | |
|     {
 | |
|       label: 'Close',
 | |
|       accelerator: 'CmdOrCtrl+W',
 | |
|       role: 'close'
 | |
|     },
 | |
|     {
 | |
|       label: 'Minimize',
 | |
|       accelerator: 'CmdOrCtrl+M',
 | |
|       role: 'minimize'
 | |
|     },
 | |
|     {
 | |
|       label: 'Zoom',
 | |
|       role: 'zoom'
 | |
|     },
 | |
|     {
 | |
|       label: 'Show',
 | |
|     },
 | |
|     {
 | |
|       type: 'separator'
 | |
|     },
 | |
|     {
 | |
|       label: 'Bring All to Front',
 | |
|       role: 'front'
 | |
|     }
 | |
|   ]
 | |
| }
 | |
| 
 | |
| module.exports = template;
 |