-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsystemTray.js
35 lines (33 loc) · 907 Bytes
/
systemTray.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
const path = require('path');
const electron = require('electron');
const app = electron.app;
const Menu = electron.Menu;
const Tray = electron.Tray;
var appIcon = null;
module.exports = {
showTrayMenu: function () {
appIcon = new Tray(path.join(__dirname, '/src/images/battery-icon.png'));
var contextMenu = Menu.buildFromTemplate([{
label: 'Settings',
type: 'normal'
},
{
label: 'About',
type: 'normal'
},
{
label: '',
type: 'separator',
},
{
label: 'Exit',
type: 'normal',
click() {
app.quit();
}
}
]);
appIcon.setToolTip('This is my application.');
appIcon.setContextMenu(contextMenu);
}
}