ComunicDesktop/ApplicationMenu.js

79 lines
1.1 KiB
JavaScript
Raw Normal View History

/**
* Application menu
*
* @author Comunic Authors
*/
const {app, Menu} = require('electron');
/**
* Get application menu
*
* @param {BrowserWindow} window
* @return {Menu} Application menu
*/
module.exports.Get = function(window){
return Menu.buildFromTemplate([
2019-02-11 17:43:03 +00:00
//File menu
{
label: "File",
submenu: [
2019-02-11 17:43:03 +00:00
//Close app
{
label: "Quit",
click: () => {
app.quit();
}
}
2019-02-11 17:43:03 +00:00
]
},
2019-02-11 17:43:03 +00:00
//Settings menu
{
label: "Settings",
submenu: [
//Dark mode
{
label: "Toggle dark mode",
click: () => {
window.webContents.executeJavaScript("ComunicWeb.components.darkTheme.setEnabled(!ComunicWeb.components.darkTheme.isEnabled());");
}
2019-02-11 17:47:09 +00:00
},
//Incognito mode
{
label: "Enable incognito mode",
sublabel: "F6",
click: () => {
window.webContents.executeJavaScript("ComunicWeb.components.incognito.ui.confirmEnable();");
}
2019-02-11 17:43:03 +00:00
}
]
},
//Advanced menu
{
label: "Advanced",
submenu: [
2019-02-11 17:43:03 +00:00
//Dev tools
{
label: "Toggle developer tools",
click: () => {
window.webContents.toggleDevTools();
}
}
2019-02-11 17:43:03 +00:00
]
}
])
}