Add a fallback when the notification icon theme is not valid - the app did not start up successfully before
This commit is contained in:
21
src/main.js
21
src/main.js
@@ -153,12 +153,21 @@ const trayImages = (() => {
|
||||
}
|
||||
case 'linux':
|
||||
{
|
||||
const theme = config.trayIconTheme || 'light';
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
||||
};
|
||||
const theme = config.trayIconTheme;
|
||||
try {
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
||||
};
|
||||
} catch (e) {
|
||||
//Fallback for invalid theme setting
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconUnreadTemplate.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconMentionTemplate.png'))
|
||||
};
|
||||
}
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
|
Reference in New Issue
Block a user