pythonmacospush-notificationiconsapple-push-notifications

Obliterating any trace of icon, but it still appears in Python-made notifications


I am using Jorrick's MacOS notifications generator to make custom MacOS popup notifications. Whenever one appears, it uses the Python Launcher rocketship icon, like this: screenshot of notification

I want to replace the rocketship image with the System Settings gear icon. So, I followed Apple Insider's tutorial on how to do so, and succeeded. This method only works with images, not .icns files - maybe there's a lead there.

I also deleted PythonLauncher.icns, the picture of the rocketship, made a .icns of the gear, and put it in the same directory with the same name, so hopefully the program would use that as the icon.

Now, PythonLauncher.app uses the gear icon in several places, but annoyingly, still not the notification icon! screenshot

  1. The Python I'm executing to make the notification. I run it with python3 notifgen.py from Terminal.
  2. The gear.png icon is used in the Get Info window
  3. The gear.png icon is used in Finder
  4. The gear.png icon is used in the Dock
  5. The .icns file I made to replace the rocketship. Changing this file does not change the previous three icons.
  6. The notification, still using the rocketship icon, even though that icon does not exist anywhere on my system. I deleted all traces of it.

To be sure I deleted all copies of the old rocketship icon, I ran sudo find / -iname '*PythonLauncher*' 2>/dev/null | tee ~/Documents/python/pythonlaunchersearch.txt. The ouput of that command is below - I added newlines and explanatory comments, and opened each file in Finder to check what it was.

#a directory which contains one directory, which is empty
/System/Volumes/Data/private/var/folders/68/kk888d5s1g99nsjkfvml43rm0000gp/C/org.python.PythonLauncher

#a text file
/System/Volumes/Data/Users/cn13431/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.python.pythonlauncher.sfl3

#the results of my find command, tee'd into a file
/System/Volumes/Data/Users/cn13431/Library/CloudStorage/OneDrive-[company name redacted]/Documents/python/pythonlaunchersearch.txt

#OneDrive junk
/System/Volumes/Data/Users/cn13431/Library/Group Containers/UBF8T346G9.OneDriveStandaloneSuite/OneDrive - [company name redacted].noindex/OneDrive - [company name redacted]/Documents/python/pythonlaunchersearch.txt

#a picture of the system settings gear icon that I renamed to PythonLauncher.icns to match the old image (the rocket)
/System/Volumes/Data/Applications/Python 3.13/Python Launcher.app/Contents/Resources/PythonLauncher.icns

#a directory which contains one directory, which is empty
/private/var/folders/68/kk888d5s1g99nsjkfvml43rm0000gp/C/org.python.PythonLauncher

#a text document
/Users/cn13431/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.python.pythonlauncher.sfl3

#OneDrive junk
/Users/cn13431/Library/CloudStorage/OneDrive-[company name redacted]/Documents/python/pythonlaunchersearch.txt

#OneDrive junk
/Users/cn13431/Library/Group Containers/UBF8T346G9.OneDriveStandaloneSuite/OneDrive - [company name redacted].noindex/OneDrive - [company name redacted], Inc/Documents/python/pythonlaunchersearch.txt

#the same system settings gear image as before - it shows up twice in search results.
/Applications/Python 3.13/Python Launcher.app/Contents/Resources/PythonLauncher.icns

I could never be a detective, because I can't find where this rocketship icon is hiding. How is Python still accessing the rocketship icon, even when it no longer exists? And how can I change the icon to be the System Settings gear instead?

Sharing an alternative to Jorrick's package that does allow to change the icon would also be a great answer. Thank you all!

Postnote: The commented icon variable in the python program isn't helpful - that puts a small icon in the bottom right, like this: notification 2


Solution

  • I got it! You still follow Apple Insider's tutorial, but you have to target a specific file hidden deep within MacOS. Copy and paste the image/icon you want into the Get Info pane of the file: /Library/Frameworks/Python.framework/Versions/3.13/Resources/Python.app

    Your path might be be different because of a different verison of Python - just replace the 3.13 with your version.