Add basic tray icon
This commit is contained in:
parent
a0119c1dcd
commit
457fb85d3f
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
13
main.js
13
main.js
|
@ -5,6 +5,17 @@ const {app, BrowserWindow, Tray} = require('electron')
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow
|
let mainWindow
|
||||||
|
|
||||||
|
|
||||||
|
function initApp() {
|
||||||
|
const tray = new Tray('./images/icon.png')
|
||||||
|
tray.setToolTip('Chimeverse')
|
||||||
|
createWindow()
|
||||||
|
|
||||||
|
tray.on('click', function() {
|
||||||
|
mainWindow.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
|
@ -35,7 +46,7 @@ function createWindow () {
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.on('ready', createWindow)
|
app.on('ready', initApp)
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
|
|
Loading…
Reference in New Issue