ico have to be in resources

This commit is contained in:
Robert Nasarek 2022-09-05 07:18:07 +02:00
parent d4afab5a72
commit f1e8197e4f
2 changed files with 31 additions and 1 deletions

32
main.js
View file

@ -11,14 +11,35 @@ const url = require('url')
let mainWindow, tray;
let devBrowserProperties = {};
let trayMenu = Menu.buildFromTemplate([
{
label: 'Öffnen',
click: function(){
mainWindow.show();
}
},
{
label: 'Schließen',
click: function(){
mainWindow.close()
}
}
])
function createTray() {
tray = new Tray('./marvin16x16.png');
tray = new Tray('./resources/files/images/marvin16x16.png');
tray.setToolTip('Marvin')
tray.setContextMenu(trayMenu);
}
// Keep a reference for dev mode
let dev = false
// Broken:
// if (process.defaultApp || /[\\/]electron-prebuilt[\\/]/.test(process.execPath) || /[\\/]electron[\\/]/.test(process.execPath)) {
// dev = true
// }
if (process.env.NODE_ENV !== undefined && process.env.NODE_ENV === 'development') {
dev = true
}
@ -187,6 +208,15 @@ function createWindow(dimensions) {
}
})
mainWindow.on('close', function (e) {
if(mainWindow.isMinimized()) {
app.quit()
} else {
e.preventDefault()
mainWindow.minimize();
}
})
mainWindow.on('closed', function () {
mainWindow = null;
})

View file

Before

Width:  |  Height:  |  Size: 434 B

After

Width:  |  Height:  |  Size: 434 B

Before After
Before After