Add tray icon for linux (Ubuntu ambiance style for now).

This commit is contained in:
Jonas Schwabe 2016-05-07 22:21:07 +02:00
parent f5e31a7534
commit 5020031235
5 changed files with 26 additions and 1 deletions

View file

@ -486,6 +486,21 @@ var showUnreadBadgeOSX = function(unreadCount, mentionCount) {
});
}
var showUnreadBadgeLinux = function(unreadCount, mentionCount) {
/*if (mentionCount > 0) {
remote.app.dock.setBadge(mentionCount.toString());
} else if (unreadCount > 0) {
remote.app.dock.setBadge('•');
} else {
remote.app.dock.setBadge('');
}*/
electron.ipcRenderer.send('update-unread', {
unreadCount: unreadCount,
mentionCount: mentionCount
});
}
var showUnreadBadge = function(unreadCount, mentionCount) {
switch (process.platform) {
case 'win32':
@ -494,6 +509,10 @@ var showUnreadBadge = function(unreadCount, mentionCount) {
case 'darwin':
showUnreadBadgeOSX(unreadCount, mentionCount);
break;
case 'linux':
console.log(unreadCount);
showUnreadBadgeLinux(unreadCount, mentionCount);
break;
default:
}
}

View file

@ -63,6 +63,12 @@ const trayImages = function() {
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnreadTemplate.png')),
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMentionTemplate.png'))
};
case 'linux':
return {
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/linux/light/MenuIconTemplate.png')),
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/linux/light/MenuIconUnreadTemplate.png')),
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/linux/light/MenuIconMentionTemplate.png'))
};
default:
return {};
}
@ -73,7 +79,7 @@ function shouldShowTrayIcon() {
if (process.platform === 'win32') {
return true;
}
if (process.platform === 'darwin' && config.showTrayIcon === true) {
if (['darwin', 'linux'].includes(process.platform) && config.showTrayIcon === true) {
return true;
}
return false;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB