Show window even if it is hidden when notification is clicked
This commit is contained in:
@@ -7,6 +7,7 @@ ipc.on('retrieveUnreadCount', function() {
|
||||
ipc.sendToHost('retrieveUnreadCount', unreadCount);
|
||||
});
|
||||
|
||||
// Show balloon when notified.
|
||||
if (process.platform === 'win32') {
|
||||
Notification = function(title, options) {
|
||||
ipc.send('notified', {
|
||||
@@ -19,3 +20,24 @@ if (process.platform === 'win32') {
|
||||
};
|
||||
Notification.prototype.close = function() {};
|
||||
}
|
||||
|
||||
// Show window even if it is hidden when notification is clicked.
|
||||
var NativeNotification = null;
|
||||
if (process.platform === 'darwin') {
|
||||
NativeNotification = Notification;
|
||||
Notification = function(title, options) {
|
||||
this.notification = new NativeNotification(title, options);
|
||||
};
|
||||
Notification.requestPermission = function(callback) {
|
||||
callback('granted');
|
||||
};
|
||||
Notification.prototype.close = function() {
|
||||
this.notification.close();
|
||||
};
|
||||
Notification.prototype.__defineSetter__('onclick', function(callback) {
|
||||
this.notification.onclick = function() {
|
||||
require('remote').getCurrentWindow().show();
|
||||
callback();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user