86 lines
1.7 KiB
JavaScript
86 lines
1.7 KiB
JavaScript
const { app, Menu } = require('electron');
|
|
const navi = require('./dock');
|
|
module.exports = function(win){
|
|
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'},
|
|
{type: 'separator'},
|
|
{role: 'resetzoom'},
|
|
{role: 'zoomin'},
|
|
{role: 'zoomout'},
|
|
{type: 'separator'},
|
|
{role: 'togglefullscreen'}
|
|
]
|
|
},
|
|
{
|
|
role: 'window',
|
|
submenu: [
|
|
{role: 'minimize'},
|
|
{role: 'close'}
|
|
]
|
|
},
|
|
{
|
|
label: 'Go',
|
|
submenu: navi.navitemplate(win)
|
|
}
|
|
]
|
|
|
|
if (process.platform === 'darwin') {
|
|
template.unshift({
|
|
label: app.getName(),
|
|
submenu: [
|
|
{role: 'about'},
|
|
{type: 'separator'},
|
|
{role: 'services', submenu: []},
|
|
{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 = [
|
|
{role: 'close'},
|
|
{role: 'minimize'},
|
|
{role: 'zoom'},
|
|
{type: 'separator'},
|
|
{role: 'front'}
|
|
]
|
|
}
|
|
|
|
const themenu = Menu.buildFromTemplate(template);
|
|
return themenu;
|
|
}
|