This repository has been archived on 2019-03-08. You can view files and clone it, but cannot push or open issues or pull requests.
MillionHopes/menu.js
2017-07-04 00:23:45 +07:00

112 lines
2.5 KiB
JavaScript

const { app, Menu,shell } = require('electron');
const navi = require('./dock');
const prefman = require('./preferencemanager');
const ipc = require('electron').ipcMain;
const options = {userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F27E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36'};
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'}
]
},
{
label: 'Go',
submenu: navi.navitemplate(win)
},
{
role: 'window',
submenu: [
{role: 'minimize'},
{role: 'close'}
]
},
{
label: 'Help',
role: 'help',
submenu: [
{
label: "Project Homepage",
click(){shell.openExternal("https://github.com/Damillora/MillionHopes")}
},
{
label: 'About SoundCleod',
click() {
prefman.showAbout();
},
visible: process.platform !== 'darwin'
}
]
}
]
if (process.platform === 'darwin') {
template.unshift({
label: app.getName(),
submenu: [
{label: 'About Million Hopes',click(){prefman.showAbout()}},
{type: 'separator'},
{label: 'Preferences',click(){prefman.showPreferences()}},
{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[4].submenu = [
{role: 'close'},
{role: 'minimize'},
{role: 'zoom'},
{type: 'separator'},
{role: 'front'}
]
}
const themenu = Menu.buildFromTemplate(template);
return themenu;
}