Merge branch 'feature/windows-trayicon-dot' into dev

This commit is contained in:
Yuya Ochiai 2016-03-01 23:42:06 +09:00
commit a3bf36b31b
4 changed files with 18 additions and 3 deletions

View file

@ -321,7 +321,9 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
// https://github.com/atom/electron/issues/4011
electron.ipcRenderer.send('win32-overlay', {
overlayDataURL: dataURL,
description: description
description: description,
unreadCount: unreadCount,
mentionCount: mentionCount
});
};
@ -332,7 +334,7 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
const dataURL = badge.createDataURL('•');
sendBadge(dataURL, 'You have unread channels');
} else {
remote.getCurrentWindow().setOverlayIcon(null, '');
sendBadge(null, 'You have no unread messages');
}
}

View file

@ -104,9 +104,22 @@ app.on('ready', function() {
});
// Set overlay icon from dataURL
// Set trayicon to show "dot"
ipc.on('win32-overlay', function(event, arg) {
var overlay = electron.nativeImage.createFromDataURL(arg.overlayDataURL);
const overlay = arg.overlayDataURL ? electron.nativeImage.createFromDataURL(arg.overlayDataURL) : null;
mainWindow.setOverlayIcon(overlay, arg.description);
var tray_image = null;
if (arg.mentionCount > 0) {
tray_image = 'tray_mention.png';
}
else if (arg.unreadCount > 0) {
tray_image = 'tray_unread.png';
}
else {
tray_image = 'tray.png';
}
trayIcon.setImage(path.resolve(__dirname, 'resources', tray_image));
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B