Hotfix tray icons for each platform
This commit is contained in:
parent
5c042b5995
commit
8615f0fd8c
|
@ -11,9 +11,23 @@ let tray = null
|
||||||
|
|
||||||
let trayService = {}
|
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) => {
|
trayService.initTray = (window) => {
|
||||||
trayServiceWindow = window
|
trayServiceWindow = window
|
||||||
let iconPath = path.join(__dirname, '/../resources/images/icon.png')
|
let iconPath = getTrayServiceIcon()
|
||||||
tray = new Tray(iconPath)
|
tray = new Tray(iconPath)
|
||||||
tray.setToolTip('Chimeverse')
|
tray.setToolTip('Chimeverse')
|
||||||
tray.on('click', function() {
|
tray.on('click', function() {
|
||||||
|
@ -26,11 +40,13 @@ trayService.initTray = (window) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
trayService.showEnvelope = () => {
|
trayService.showEnvelope = () => {
|
||||||
tray.setImage(path.join(__dirname, '/../resources/images/envelope.png'))
|
let iconPath = getTrayServiceIcon('envelope')
|
||||||
|
tray.setImage(iconPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
trayService.hideEnvelope = () => {
|
trayService.hideEnvelope = () => {
|
||||||
tray.setImage(path.join(__dirname, '/../resources/images/icon.png'))
|
let iconPath = getTrayServiceIcon()
|
||||||
|
tray.setImage(iconPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = trayService
|
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 |
Loading…
Reference in New Issue