Merge branch 'feature/windows-trayicon-dot' into dev
This commit is contained in:
commit
a3bf36b31b
|
@ -321,7 +321,9 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
|
||||||
// https://github.com/atom/electron/issues/4011
|
// https://github.com/atom/electron/issues/4011
|
||||||
electron.ipcRenderer.send('win32-overlay', {
|
electron.ipcRenderer.send('win32-overlay', {
|
||||||
overlayDataURL: dataURL,
|
overlayDataURL: dataURL,
|
||||||
description: description
|
description: description,
|
||||||
|
unreadCount: unreadCount,
|
||||||
|
mentionCount: mentionCount
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -332,7 +334,7 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
|
||||||
const dataURL = badge.createDataURL('•');
|
const dataURL = badge.createDataURL('•');
|
||||||
sendBadge(dataURL, 'You have unread channels');
|
sendBadge(dataURL, 'You have unread channels');
|
||||||
} else {
|
} else {
|
||||||
remote.getCurrentWindow().setOverlayIcon(null, '');
|
sendBadge(null, 'You have no unread messages');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
src/main.js
15
src/main.js
|
@ -104,9 +104,22 @@ app.on('ready', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set overlay icon from dataURL
|
// Set overlay icon from dataURL
|
||||||
|
// Set trayicon to show "dot"
|
||||||
ipc.on('win32-overlay', function(event, arg) {
|
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);
|
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));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
src/resources/tray_mention.png
Normal file
BIN
src/resources/tray_mention.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 735 B |
BIN
src/resources/tray_unread.png
Normal file
BIN
src/resources/tray_unread.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 715 B |
Loading…
Reference in a new issue