Last active
August 21, 2018 05:51
-
-
Save SomeKay/19c859e8cedd407bfdac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var remote = require('remote'); | |
var Tray = remote.require('tray'); | |
var Menu = remote.require('menu'); | |
var path = require('path'); | |
var trayIcon = null; | |
if (process.platform === 'darwin') { | |
trayIcon = new Tray(path.join(__dirname, 'img/tray-iconTemplate.png')); | |
} | |
else { | |
trayIcon = new Tray(path.join(__dirname, 'img/tray-icon-alt.png')); | |
} | |
var trayMenuTemplate = [ | |
{ | |
label: 'Sound machine', | |
enabled: false | |
}, | |
{ | |
label: 'Settings', | |
click: function () { | |
ipc.send('open-settings-window'); | |
} | |
}, | |
{ | |
label: 'Quit', | |
click: function () { | |
ipc.send('close-main-window'); | |
} | |
} | |
]; | |
var trayMenu = Menu.buildFromTemplate(trayMenuTemplate); | |
trayIcon.setContextMenu(trayMenu); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need these variables to make it work: