Files
icos
newton
app.js
args-parser.js
fs.js
ipc.js
main.js
menu.js
preload.js
settings-manager.js
system-tray.js
public
src
.gitignore
LICENSE
README.md
angular.json
package.json
tsconfig.app.json
tsconfig.json
tsconfig.spec.json
Newton-Editor/newton/system-tray.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

const { Tray, Menu } = require('electron')
const { newtonFs } = require('./fs');
const load = (win) => {
let trayIcon = new Tray( newtonFs.getIconPath() );
const trayMenuTemplate = [
{
label: "File",
submenu: [
{
label: 'New',
click: () => win.webContents.send('menu-actions', "new-file")
}, {
label: 'Open',
click: () => win.webContents.send('menu-actions', "open-files")
}, {
label: 'save',
click: () => win.webContents.send('menu-actions', "save-file")
}, {
label: 'Save As',
click: () => win.webContents.send('menu-actions', "save-file-as")
}, {
label: 'Terminal',
click: () => {}
}
]
}, {
label: 'Settings',
click: () => win.webContents.send('menu-actions', "open-settings")
}, {
label: 'Help',
click: () => win.webContents.send('menu-actions', "show-about")
}
];
trayIcon.setContextMenu(
Menu.buildFromTemplate(trayMenuTemplate)
);
}
module.exports = {
systemTray: {
load: load,
}
};