Reputation: 313
My application uses a separate hidden BrowserWindow to show a new notification. The notification has 2 icons. I cannot edit the electron icon on the left, while the icon on the right kan be edited just fine.
How can I change the left icon?
I've tried changing the icon of the BrowserWindow and changing the icon of electron through the electron-packager. I've also changed the favicon icon of the page spawning the notification, but to no avail.
I cannot find any other documentation regarding it even being possible to have 2 icons in a notification. By my knowledge it should be a native HTML5 Notification.
Platform: Mac OS X El Capitan
Electron version: 1.1.1
Code used in renderer Javascript:
const electron = require('electron');
const ipc = electron.ipcRenderer;
var Notification = window.Notification || window.mozNotification || window.webkitNotification;
require('electron').ipcRenderer.on('showNotification', (event, message) => {
Notification.requestPermission();
var notification = new Notification("New Notification found");
});
require('electron').ipcRenderer.on('showNotificationAmount', (event, message) => {
Notification.requestPermission();
var notification = new Notification("New Notifications found!", {icon: "http://orig07.deviantart.net/d754/f/2011/132/e/4/google_chrome_icon_yellow_by_cameronsagey-d3g75gy.png", body: message + " new notifications available for you!"});
});
Code used in Main.js:
//Make hidden window, used for notifications
hiddenNotificationBalloonWindow = new window({
show: false,
transparent: true,
icon: nativeImage.createFromPath(__dirname + '/images/logowindowicon.png')
});
hiddenNotificationBalloonWindow.setRepresentedFilename(__dirname + '/images/logowindowicon.png');
hiddenNotificationBalloonWindow.setDocumentEdited(true);
hiddenNotificationBalloonWindow.loadURL("file://" + __dirname + "/windows/hiddenHTML5NotifyBalloonActivator.html");
Thanks for the help in advance!
Upvotes: 5
Views: 4981
Reputation: 313
After reading through this: OSX Notification Center Icon
I noticed that adding a app-bundle-id through electron-packager fixed the issue for me. The issue was caused by icon caching in Mac OS X. Simply deleting the cache files did not solve the issue for me. Changing/adding a bundle-id did though.
Upvotes: 3