Add basic tray icon

This commit is contained in:
Nick Denry 2019-04-25 04:11:30 +03:00
parent a0119c1dcd
commit 457fb85d3f
2 changed files with 12 additions and 1 deletions

BIN
images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

13
main.js
View File

@ -5,6 +5,17 @@ const {app, BrowserWindow, Tray} = require('electron')
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function initApp() {
const tray = new Tray('./images/icon.png')
tray.setToolTip('Chimeverse')
createWindow()
tray.on('click', function() {
mainWindow.show();
});
}
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
@ -35,7 +46,7 @@ function createWindow () {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
app.on('ready', initApp)
// Quit when all windows are closed.
app.on('window-all-closed', function () {