Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
// and load the index.html of the app.
win.loadFile('./src/index.html');
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
aboutWin = null;
});
// Create a menu using template
const menu = Menu.buildFromTemplate(buildMenuTemplate(win));
// Create about window
menu.getMenuItemById('about').click = () => {
if (!aboutWin) {
aboutWin = new BrowserWindow({
width: 300,
height: 150,
resizable: false,
frame: false,
parent: win,
modal: true,
webPreferences: {
nodeIntegration: true
},
});
const setContextMenu = (track) => {
const contextMenu = Menu.buildFromTemplate([
{
label: 'Service',
enabled: false,
},
{
label: TranslationProvider.query('tray-label-gpm'),
click: () => {
// DEV: default to the other service so it will switch if not set.
const currentService = Settings.get('service', 'youtube-music');
if (currentService !== 'google-play-music') {
Settings.set('service', 'google-play-music');
mainWindow.hide();
mainWindow.reload();
}
},
},
click: function() { mainWindow.getBrowserWindow().webContents.toggleDevTools(); }
}
]
}
] as Electron.MenuItemOptions[];
if (process.platform === "darwin" ) {
menuItems.unshift(
{
label: "CafePitch",
submenu: [
{ label: "Quit", accelerator: "CmdOrCtrl+Q", click: () => app.quit() }
]
}
);
}
Menu.setApplicationMenu(Menu.buildFromTemplate(menuItems));
};
},
]
if (process.env.APPIMAGE !== undefined) {
template[6].submenu.push({type: 'separator'})
template[6].submenu.push({
label: global.p3x.onenote.lang.menu.help.checkUpdates,
click: () => {
const {autoUpdater} = require("electron-updater");
autoUpdater.checkForUpdatesAndNotify();
}
},
)
}
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
],
},
{
role: 'help',
submenu: [
{
label: 'Website',
click () {
shell.openExternal('https://eugeny.github.io/terminus')
},
},
],
}
]
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
}
}
function createMenuOther(openFolder, theme, info) {
var menu = Menu.buildFromTemplate([openFolder, theme, info])
Menu.setApplicationMenu(menu)
}
ApplicationMenu.prototype.attachToWindow = function () {
this.menu = Menu.buildFromTemplate(_.deepClone(this.template));
Menu.setApplicationMenu(this.menu);
};
},
{
label: 'Zoom',
role: 'zoom',
},
{
type: 'separator',
},
{
label: 'Bring All to Front',
role: 'front',
},
];
}
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
app.on('ready', () => {
const template = [{
label: 'File',
submenu: [{
label: 'Open',
click() {}
}]
}];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
mainWindow = new BrowserWindow({
height: 720,
width: 1024
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
});
if (isDevelopment) {
ctxMenuTmpl = ctxMenuTmpl.concat([
{ type: 'separator' },
{
label: 'Inspect Element',
click: () => {
window.webContents.inspectElement(props.x, props.y);
if (window.webContents.isDevToolsOpened()) {
window.webContents.devToolsWebContents.focus();
}
}
}
]);
}
const ctxMenu = Menu.buildFromTemplate(ctxMenuTmpl);
const popupOpts: PopupOptions = {
window,
x: props.x,
y: props.y
};
ctxMenu.popup(popupOpts);
}