-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (34 loc) · 1.19 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var menubar = require('menubar')
const { Menu } = require("electron");
var mb = menubar({
dir: __dirname + '/src',
tooltip: 'TranslateYa',
preloadWindow: true,
width: 300,
height: 150
})
mb.on('ready', function ready () {
var template = [{
label: "Application",
submenu: [
{ label: "About", selector: "orderFrontStandardAboutPanel:" },
{ type: "separator" },
{ label: "Quit", accelerator: "Command+Q", click: function() { mb.app.quit(); }}
]}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]}
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
})
// Reload app on hide
mb.on('after-hide', function () {
mb.window.reload();
});