Skip to content

Commit

Permalink
added tray icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed Jul 2, 2020
1 parent b7e4f75 commit 4173892
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion electron/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, autoUpdater, dialog} = require('electron');
const { app, BrowserWindow, autoUpdater, dialog, Tray, Menu} = require('electron');
const path = require('path');
require('update-electron-app')({
repo:'jacobmichels/boosted',
Expand Down Expand Up @@ -40,6 +40,19 @@ const createWindow = () => {
resizable:false
});

mainWindow.on('minimize',event=>{
event.preventDefault();
mainWindow.hide();
});

let appTray = new Tray(path.join(__dirname,'..\\resources\\icons\\lol-icon.png'));
let menu = Menu.buildFromTemplate([{label:'Show App',click:()=>{mainWindow.show();}},{label:'Quit',click:()=>{app.quit();}}]);
appTray.setContextMenu(menu);
appTray.on('double-click',()=>{
mainWindow.show();
})


mainWindow.on('ready-to-show',()=>{
mainWindow.show();
})
Expand Down

0 comments on commit 4173892

Please sign in to comment.