Hotfix tray icons for each platform

This commit is contained in:
Nick Denry 2020-05-18 17:51:43 +03:00
parent 5c042b5995
commit 8615f0fd8c
5 changed files with 19 additions and 3 deletions

View File

@ -11,9 +11,23 @@ let tray = null
let trayService = {}
let getTrayServiceIcon = (iconName = 'icon') => {
let iconImage = ''
if (process.platform === 'darwin') {
iconImage = iconName
}
else if (process.platform === 'win32') {
iconImage = iconName+'-16x16'
}
else {
iconImage = iconName+'-48x48'
}
return path.join(__dirname, '/../resources/images/' + iconImage + '.png')
}
trayService.initTray = (window) => {
trayServiceWindow = window
let iconPath = path.join(__dirname, '/../resources/images/icon.png')
let iconPath = getTrayServiceIcon()
tray = new Tray(iconPath)
tray.setToolTip('Chimeverse')
tray.on('click', function() {
@ -26,11 +40,13 @@ trayService.initTray = (window) => {
}
trayService.showEnvelope = () => {
tray.setImage(path.join(__dirname, '/../resources/images/envelope.png'))
let iconPath = getTrayServiceIcon('envelope')
tray.setImage(iconPath)
}
trayService.hideEnvelope = () => {
tray.setImage(path.join(__dirname, '/../resources/images/icon.png'))
let iconPath = getTrayServiceIcon()
tray.setImage(iconPath)
}
module.exports = trayService

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB