ico have to be in resources
This commit is contained in:
parent
d4afab5a72
commit
f1e8197e4f
2 changed files with 31 additions and 1 deletions
32
main.js
32
main.js
|
|
@ -11,14 +11,35 @@ const url = require('url')
|
||||||
let mainWindow, tray;
|
let mainWindow, tray;
|
||||||
let devBrowserProperties = {};
|
let devBrowserProperties = {};
|
||||||
|
|
||||||
|
let trayMenu = Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: 'Öffnen',
|
||||||
|
click: function(){
|
||||||
|
mainWindow.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Schließen',
|
||||||
|
click: function(){
|
||||||
|
mainWindow.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
function createTray() {
|
function createTray() {
|
||||||
tray = new Tray('./marvin16x16.png');
|
tray = new Tray('./resources/files/images/marvin16x16.png');
|
||||||
tray.setToolTip('Marvin')
|
tray.setToolTip('Marvin')
|
||||||
|
tray.setContextMenu(trayMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep a reference for dev mode
|
// Keep a reference for dev mode
|
||||||
let dev = false
|
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') {
|
if (process.env.NODE_ENV !== undefined && process.env.NODE_ENV === 'development') {
|
||||||
dev = true
|
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.on('closed', function () {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |
Loading…
Add table
Add a link
Reference in a new issue