tooltip: 'You logout and can login again',
click: action.restart
},
{
label: visible ? 'Hide' : 'Show',
click: action.toggleVisible
},
{
label: 'Download',
click: action.download
},
{
label: 'Quit',
click: action.quit
}
]
}
}
function createMenu() {
const template = [
{
label: title,
submenu: menus.default(),
},
{
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: 'help',
submenu: [
{
label: 'Download',
click: action.download
},
{
label: 'GitHub',
click: action.github
},
{
label: 'Patrik Laszlo',
click: action.patrik
},
{
label: 'P3X',
click: action.p3x
},
{
label: 'Corifeus',
click: action.corifeus
},
{
label: 'Npm',
click: action.npm
},
]
}
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
function createTray() {
if (tray === undefined) {
tray = new Tray(iconFile)
tray.setToolTip(title)
tray.on('click', action.toggleVisible)
}
const contextMenu = Menu.buildFromTemplate(menus.default())
tray.setContextMenu(contextMenu)
}
function setVisible(visible = true) {
if (visible === null) {
visible = true;
}
if (mainWindow !== undefined) {
if (visible) {
mainWindow.show();
} else {
mainWindow.hide();
}
}
conf.set('visible', visible);
createMenu();
createTray()