Added icon management for linux.

This commit is contained in:
Quentin DECAUNES 2019-03-11 11:23:23 +01:00
parent cb98987073
commit 6a459ba060
2 changed files with 10 additions and 2 deletions

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

12
main.js
View File

@ -29,13 +29,21 @@ let mainWindow
let tray let tray
function createWindow () { function createWindow () {
let appIcon = '';
if (require('os').platform() === 'win32') {
appIcon = __dirname + '/assets/icon.ico';
} else {
appIcon = __dirname + '/assets/icon.png';
}
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 800, width: 800,
height: 720, height: 720,
webPreferences: { webPreferences: {
nodeIntegration: true nodeIntegration: true
} },
icon: appIcon
}) })
mainWindow.setOpacity(0.95); mainWindow.setOpacity(0.95);
@ -77,7 +85,7 @@ function createWindow () {
} }
]); ]);
tray = new Tray(__dirname + '/assets/icon.ico'); tray = new Tray(appIcon);
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);
tray.setIgnoreDoubleClickEvents(true); tray.setIgnoreDoubleClickEvents(true);
tray.on('click', function() { tray.on('click', function() {