Fix icon path on MacOS.

Remove unnecessary variable.
This commit is contained in:
Keith Maika 2022-03-15 22:27:47 -04:00
parent 933c853395
commit 6f5cc13b2e
1 changed files with 5 additions and 11 deletions

View File

@ -2,20 +2,17 @@
* Module for Tray functions.
*/
const { BrowserWindow, Tray } = require('electron')
const { Tray } = require('electron')
const path = require('path')
let trayServiceWindow = null
let tray = null
const trayService = {}
const getTrayServiceIcon = (iconName = 'icon') => {
let iconImage = ''
if (process.platform === 'darwin') {
iconImage = iconName
} else if (process.platform === 'win32') {
let iconImage;
if (process.platform === 'darwin' || process.platform === 'win32') {
iconImage = iconName+'-16x16'
} else {
iconImage = iconName+'-48x48'
@ -24,16 +21,13 @@ const getTrayServiceIcon = (iconName = 'icon') => {
}
trayService.initTray = (window) => {
trayServiceWindow = window
const iconPath = getTrayServiceIcon()
tray = new Tray(iconPath)
tray.setToolTip('Converse Desktop')
tray.on('click', function() {
// Sent open-related-chat event only on click
const activeWindow = BrowserWindow.getAllWindows()[0]
activeWindow.webContents.send('open-unread-chat')
window.webContents.send('open-unread-chat')
trayService.hideEnvelope()
trayServiceWindow.show()
window.show()
})
}