Why do I see the default terminal icon when I'm setting my own? (OS X) #71

Closed
lipis opened this Issue Oct 7, 2015 · 21 comments

Comments

Projects
None yet
@lipis

lipis commented Oct 7, 2015

This happens on OS X (didn't test other platforms) when I'm not have the icon option:
screen shot 2015-10-07 at 11 31 41

and when I have it:
screen shot 2015-10-07 at 11 32 05

Am I missing something? How could I get rid of the terminal icon next to the title?

  notifier.notify({
    title: 'Title',
    message: 'Hello, world!',
    icon: 'path/to/image.png,
  }, function(error, response) {
    console.log('error', response);
  });
@adrienaggery

This comment has been minimized.

Show comment
Hide comment
@adrienaggery

adrienaggery Oct 9, 2015

Same issue here.
Haven't found any solutions

Same issue here.
Haven't found any solutions

@mikaelbr

This comment has been minimized.

Show comment
Hide comment
@mikaelbr

mikaelbr Oct 9, 2015

Owner

No, I'm afraid that's how the notification work, as it's the terminal that initiates the message. The only way to avoid this is to use your custom terminal-notifier where the Terminal icon is swapped for your own. It's not a big task, and you can easily set customPath for notification center reporter.

Owner

mikaelbr commented Oct 9, 2015

No, I'm afraid that's how the notification work, as it's the terminal that initiates the message. The only way to avoid this is to use your custom terminal-notifier where the Terminal icon is swapped for your own. It's not a big task, and you can easily set customPath for notification center reporter.

@kurisubrooks

This comment has been minimized.

Show comment
Hide comment
@kurisubrooks

kurisubrooks Oct 11, 2015

Collaborator

This happens because of the way notifications in macOS work. The notification shows the referring app's icon, and as we're using terminal-notifier to push notifications for macOS, we have the icon of terminal-notifier.

To work around this, you'll need to compile terminal-notifier with your own app.icns. Download the source, change out the AppIcon bundle with your own in Xcode, recompile terminal-notifier and pop it into node-notifier. (/node-notifier/vendor/terminal-notifier.app)

Now that you have your own terminal-notifier inside node-notifier, remove all the icon references from your OS X Notification Center code, and run the notification as if it has no icon. If the old app icon is showing in your notifications, you need to clear your local icon cache. (Google how to do this)

If you have any questions, feel free to ping me 🙂 ~

screenshot 2015-11-05 00 48 38

Collaborator

kurisubrooks commented Oct 11, 2015

This happens because of the way notifications in macOS work. The notification shows the referring app's icon, and as we're using terminal-notifier to push notifications for macOS, we have the icon of terminal-notifier.

To work around this, you'll need to compile terminal-notifier with your own app.icns. Download the source, change out the AppIcon bundle with your own in Xcode, recompile terminal-notifier and pop it into node-notifier. (/node-notifier/vendor/terminal-notifier.app)

Now that you have your own terminal-notifier inside node-notifier, remove all the icon references from your OS X Notification Center code, and run the notification as if it has no icon. If the old app icon is showing in your notifications, you need to clear your local icon cache. (Google how to do this)

If you have any questions, feel free to ping me 🙂 ~

screenshot 2015-11-05 00 48 38

@lipis

This comment has been minimized.

Show comment
Hide comment
@lipis

lipis Oct 14, 2015

Thanks @kurisubrooks but I won't try it at the moment, since that wasn't urgent and it looks like it's not that straight forward. The Notifications API works nicely on OSX so I'll rely on this one now..

lipis commented Oct 14, 2015

Thanks @kurisubrooks but I won't try it at the moment, since that wasn't urgent and it looks like it's not that straight forward. The Notifications API works nicely on OSX so I'll rely on this one now..

@zimo888

This comment has been minimized.

Show comment
Hide comment
@zimo888

zimo888 Aug 24, 2016

@GeorgeBgk
Navigate to node_modules/node-notifier/vendor
Rename your custom icon into Terminal.icns
Right-click terminal-notifier file and click Show Package Contents
Navigate to Contents/Resources
Replace Terminal.icns file with your own
Open terminal-notifier/Contents/Info.plist

The most important things are the next two steps.
Change the build version to anything.
Change the bundle identifier to anything.

zimo888 commented Aug 24, 2016

@GeorgeBgk
Navigate to node_modules/node-notifier/vendor
Rename your custom icon into Terminal.icns
Right-click terminal-notifier file and click Show Package Contents
Navigate to Contents/Resources
Replace Terminal.icns file with your own
Open terminal-notifier/Contents/Info.plist

The most important things are the next two steps.
Change the build version to anything.
Change the bundle identifier to anything.

@averissimo

This comment has been minimized.

Show comment
Hide comment
@averissimo

averissimo Dec 1, 2016

If you are running a packaged electron app, you need to have the CFBundleIdentifier value in the Info.plist equal to the sender property when calling notifiy

we just experienced this when building the OSX app with yakyak. they didn't match and the terminal started appearing.

If you are running a packaged electron app, you need to have the CFBundleIdentifier value in the Info.plist equal to the sender property when calling notifiy

we just experienced this when building the OSX app with yakyak. they didn't match and the terminal started appearing.

emsk added a commit to emsk/redmine-notifier that referenced this issue Feb 16, 2017

Remove small terminal icon in main notification for macOS
Change the icon using customise-terminal-notifier.

executed command: `customise-terminal-notifier -i ./app/images/redmine_icon_color_64.png -b com.emsk.redmine-notifier`

mikaelbr/node-notifier#71
julienXX/terminal-notifier#131
https://github.com/vitorgalvao/tiny-scripts/blob/master/customise-terminal-notifier
@mbushpilot2b

This comment has been minimized.

Show comment
Hide comment
@mbushpilot2b

mbushpilot2b Feb 20, 2017

Here is a step by step:

  1. Clone or download https://github.com/mikaelbr/terminal-notifier

  2. download xcode

  3. delete Terminal.icns inside of terminal-notifier folder (empty trash too.)

  4. drag in your apps .icns inside of terminal-notifier folder. (dont know how to make a .icns? Use .png to .icns converter: https://iconverticons.com/online/)

  5. open Xcode project file inside terminal-notifier folder

  6. change Bundle identifier: nl.superalloy.oss.${DIAMOND:rfc1034identifier} to nl.superalloy.oss.${WHATEVERYOURAPPNAMEIS:rfc1034identifier} my app name happened to be diamond.

  7. also for good measure i changed the bundle and bundle version to random numbers of my choosing.

  8. this is the magic: change iconfile to the NAME of the .icns that you included in the terminal-notifier folder in step 4.

  9. Now CLEAN the project before building. Cmd + Shift + K

  10. then build Cmd + Shift + B

  11. to find the built app in xcode right-click on:

    and select "Show In Finder"

  12. copy that to replace your old terminal-notifier.app in your project folder which should be inside of your yourProjectName/node_modules/node-notifier/vendor/terminal-notifier.app

  13. you can check to see if the new icon works by double clicking on the terminal-notifier.app and a notification should show up with your new icon!

THEN you have to USE the custom path when calling for a notification in electron so it uses your version and not OSX's.
14. copy path to new app:

should look something like this: /Users/yourcomputeraccountname/Desktop/nameofyourelectronappfolder/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier

  1. then anywhere you want to create a notification set the "custom path" to that path above^

  2. If you want to change the name of the app that the notification comes from, from terminal-notifier to yourAppName, then just change the name of the project here:

    And the target name here:

    that should do it if not go crazy changing anything that says app name anywhere from terminal-notifier to yourAppName, also change name of the (manage schemes) (search in help bar of xcode)

mbushpilot2b commented Feb 20, 2017

Here is a step by step:

  1. Clone or download https://github.com/mikaelbr/terminal-notifier

  2. download xcode

  3. delete Terminal.icns inside of terminal-notifier folder (empty trash too.)

  4. drag in your apps .icns inside of terminal-notifier folder. (dont know how to make a .icns? Use .png to .icns converter: https://iconverticons.com/online/)

  5. open Xcode project file inside terminal-notifier folder

  6. change Bundle identifier: nl.superalloy.oss.${DIAMOND:rfc1034identifier} to nl.superalloy.oss.${WHATEVERYOURAPPNAMEIS:rfc1034identifier} my app name happened to be diamond.

  7. also for good measure i changed the bundle and bundle version to random numbers of my choosing.

  8. this is the magic: change iconfile to the NAME of the .icns that you included in the terminal-notifier folder in step 4.

  9. Now CLEAN the project before building. Cmd + Shift + K

  10. then build Cmd + Shift + B

  11. to find the built app in xcode right-click on:

    and select "Show In Finder"

  12. copy that to replace your old terminal-notifier.app in your project folder which should be inside of your yourProjectName/node_modules/node-notifier/vendor/terminal-notifier.app

  13. you can check to see if the new icon works by double clicking on the terminal-notifier.app and a notification should show up with your new icon!

THEN you have to USE the custom path when calling for a notification in electron so it uses your version and not OSX's.
14. copy path to new app:

should look something like this: /Users/yourcomputeraccountname/Desktop/nameofyourelectronappfolder/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier

  1. then anywhere you want to create a notification set the "custom path" to that path above^

  2. If you want to change the name of the app that the notification comes from, from terminal-notifier to yourAppName, then just change the name of the project here:

    And the target name here:

    that should do it if not go crazy changing anything that says app name anywhere from terminal-notifier to yourAppName, also change name of the (manage schemes) (search in help bar of xcode)

@fritx

This comment has been minimized.

Show comment
Hide comment
@fritx

fritx Mar 24, 2017

Another quick solution here (inspired by @mbushpilot2b):

  1. install node-notifier normally

    npm install node-notifier
    
  2. hack assets of terminal-notifier

    cd node_modules/node-notifier/vendor
    cd terminal-notifier.app/Contents
    sed -i -- 's/terminal-notifier/genius-notifier/g' Info.plist  # replace identifiers
    sed -i -- 's/Terminal/Genius/g' Info.plist  # replace icon
    rm Resources/Terminal.icns  # remove the original icon
    cp my/resource/Genius.icns Resources/Genius.icns  # replaced by our own icon
    

fritx commented Mar 24, 2017

Another quick solution here (inspired by @mbushpilot2b):

  1. install node-notifier normally

    npm install node-notifier
    
  2. hack assets of terminal-notifier

    cd node_modules/node-notifier/vendor
    cd terminal-notifier.app/Contents
    sed -i -- 's/terminal-notifier/genius-notifier/g' Info.plist  # replace identifiers
    sed -i -- 's/Terminal/Genius/g' Info.plist  # replace icon
    rm Resources/Terminal.icns  # remove the original icon
    cp my/resource/Genius.icns Resources/Genius.icns  # replaced by our own icon
    
@tolgaergin

This comment has been minimized.

Show comment
Hide comment
@tolgaergin

tolgaergin Mar 26, 2017

hey @fritx Thanks for quick solution.
Is there any missing step left? After I did what you wrote, I can't see any notification but the listeners such as timeout is working.

tolgaergin commented Mar 26, 2017

hey @fritx Thanks for quick solution.
Is there any missing step left? After I did what you wrote, I can't see any notification but the listeners such as timeout is working.

@fritx fritx referenced this issue in nwjs/nw.js Apr 19, 2017

Closed

0.13: Native desktop notifications #4560

@fritx

This comment has been minimized.

Show comment
Hide comment
@fritx

fritx May 23, 2017

@tolgaergin hey, did you replace the icns with an existing one of your own?

fritx commented May 23, 2017

@tolgaergin hey, did you replace the icns with an existing one of your own?

@gbougakov

This comment has been minimized.

Show comment
Hide comment
@gbougakov

gbougakov May 25, 2017

Here's a quick guide how to do it. (If you don't have an ICNS file, here's a converter)

  1. Navigate to node_modules/node-notifier/vendor
  2. Rename your custom icon into Terminal.icns
  3. Right-click terminal-notifier file and click Show Package Contents
  4. Navigate to Contents/Resources
  5. Replace Terminal.icns file with your own
    ezgif-2-637e763ed9

Here you go! Hope this helps.

Here's a quick guide how to do it. (If you don't have an ICNS file, here's a converter)

  1. Navigate to node_modules/node-notifier/vendor
  2. Rename your custom icon into Terminal.icns
  3. Right-click terminal-notifier file and click Show Package Contents
  4. Navigate to Contents/Resources
  5. Replace Terminal.icns file with your own
    ezgif-2-637e763ed9

Here you go! Hope this helps.

@fritx

This comment has been minimized.

Show comment
Hide comment
@fritx

fritx May 26, 2017

@GeorgeBgk oops, I don't think it is a good idea to replace Terminal.icns directly,
without replacing identifiers in plist mentioned at #71 (comment).

It seems that would cause other apps on your computer, which are using node-terminal as well, to show the replaced icon, not the original one. That would be confusing.

fritx commented May 26, 2017

@GeorgeBgk oops, I don't think it is a good idea to replace Terminal.icns directly,
without replacing identifiers in plist mentioned at #71 (comment).

It seems that would cause other apps on your computer, which are using node-terminal as well, to show the replaced icon, not the original one. That would be confusing.

@gbougakov

This comment has been minimized.

Show comment
Hide comment
@gbougakov

gbougakov May 26, 2017

@fritx You are incorrect. I replace Terminal.icns only in my project. It does not affect others, I tested

@fritx You are incorrect. I replace Terminal.icns only in my project. It does not affect others, I tested

ramijarrar added a commit to fractal-code/node-notifier that referenced this issue Jul 11, 2017

@yourfavorite

This comment has been minimized.

Show comment
Hide comment
@yourfavorite

yourfavorite Aug 8, 2017

@GeorgeBgk I tried your method and my electron app still shows the terminal icon. Is there some cache clean command I need to run?

I tried this: https://gist.github.com/fabiofl/5873100 but it didn't fix the issue. I'm pretty sure I have placed the icon correctly but there might be an issue as get info on terminal-notifier.app shows the correct icon but notice the titlebar still has the terminal icon: icon

yourfavorite commented Aug 8, 2017

@GeorgeBgk I tried your method and my electron app still shows the terminal icon. Is there some cache clean command I need to run?

I tried this: https://gist.github.com/fabiofl/5873100 but it didn't fix the issue. I'm pretty sure I have placed the icon correctly but there might be an issue as get info on terminal-notifier.app shows the correct icon but notice the titlebar still has the terminal icon: icon

@rien333

This comment has been minimized.

Show comment
Hide comment
@rien333

rien333 Nov 18, 2017

My personal solution is to create an application with a fully transparent icon, and call it's sender ID with -sender flag.

rien333 commented Nov 18, 2017

My personal solution is to create an application with a fully transparent icon, and call it's sender ID with -sender flag.

@djalmaaraujo

This comment has been minimized.

Show comment
Hide comment
@djalmaaraujo

djalmaaraujo Dec 5, 2017

@rien333 can u show some code?

@rien333 can u show some code?

@rien333

This comment has been minimized.

Show comment
Hide comment
@rien333

rien333 Dec 5, 2017

idk, nothing too fancy: terminal-notifier -message 'hi' -title "$(date +"%H:%M")" -appIcon img.jpg -sender 'rw.EmptyApp' The actual important part is creating an app with the bundle identifier 'rw.emptyApp' (or any bundle ID of your choosing) with for example Xcode. Google can surely show you how. As said, this app should have a fully transparent icon so it will not show up in the notification (only as whitespace I guess) I think some of the spacing is off due to the whitespace tho somewhere (the title field maybe?) but it does avoid the icon.

rien333 commented Dec 5, 2017

idk, nothing too fancy: terminal-notifier -message 'hi' -title "$(date +"%H:%M")" -appIcon img.jpg -sender 'rw.EmptyApp' The actual important part is creating an app with the bundle identifier 'rw.emptyApp' (or any bundle ID of your choosing) with for example Xcode. Google can surely show you how. As said, this app should have a fully transparent icon so it will not show up in the notification (only as whitespace I guess) I think some of the spacing is off due to the whitespace tho somewhere (the title field maybe?) but it does avoid the icon.

@code-with-sam

This comment has been minimized.

Show comment
Hide comment
@code-with-sam

code-with-sam Jan 4, 2018

For anyone who finds their way to this issue. I found this script from 'vitorgalvao/tiny-scripts' which had since been removed from the repo. I brought it back to life incase it can help anyone else here.

https://github.com/code-with-sam/customise-terminal-notifier

For anyone who finds their way to this issue. I found this script from 'vitorgalvao/tiny-scripts' which had since been removed from the repo. I brought it back to life incase it can help anyone else here.

https://github.com/code-with-sam/customise-terminal-notifier

@damianobarbati

This comment has been minimized.

Show comment
Hide comment
@damianobarbati

damianobarbati May 28, 2018

Oh no! Did anybody find a solution to this?

Having to create a window+renderer just to show a notification is crazy :\

Oh no! Did anybody find a solution to this?

Having to create a window+renderer just to show a notification is crazy :\

@laxmikanta415

This comment has been minimized.

Show comment
Hide comment
@laxmikanta415

laxmikanta415 Jun 13, 2018

This solved my problem and you only need to have your icns file ready:

run this command in terminal after downloading :customise-terminal-notifier

** path/customise-terminal-notifier-master/customise-terminal-notifier -i path/Terminal.icns -b com.bundle.identifier

This solved my problem and you only need to have your icns file ready:

run this command in terminal after downloading :customise-terminal-notifier

** path/customise-terminal-notifier-master/customise-terminal-notifier -i path/Terminal.icns -b com.bundle.identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment