Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the notification icon in an applescript

I've written a couple applescripts to help me automate some frequent repetive tasks and I use notifications to identify when the script has finished. I would like to be able to change the icon on the notification, but it only displays the 'Script Editor' icon.

I've save the script files as applications and changed the icons of the script.app file but it still shows the default 'Script Editor' icon. any ideas? Below is an example of the applescript code I'm using to display the notification as well as a picture of the notification

display notification "This is the message" with title "This is the title"
like image 394
Jake Henningsgaard Avatar asked Mar 16 '23 21:03

Jake Henningsgaard


1 Answers

You should place your icon in the Applications resource folder. Or give it the same name as the default icon file. applet.icns and replace the original.

enter image description here

If you choose to use a new file and not replace the original then you will also have to change the name of the icon file in the info.plist file.

enter image description here


enter image description here


enter image description here

Some things to note.

The icon image size may need to be no bigger than 256px , I found that although the app file icon changed the Notifications did not if it was bigger. ( This may just be my mac)

Make sure you get it right the first time. If you change your mind on the icon once the system has picked it up there seems to be a bug where it will continue to show the old one even if you have delete all record of it.

Yosemite seems to be caching it some how.

The only way I found t get around this when I wanted to change the icon again was to save anew app with a different name.

Your app file icon may not change straight away in the finder. One way around this is to select the app file and duplicate it. The copy will normally pick up the icon

like image 67
markhunte Avatar answered Apr 08 '23 15:04

markhunte