0

Desired result:

All .py files show a nice Python icon, regardless of what default program they opened with. (Same for .cpp files, .txt files, etc)

_

How it currently works:

Files (ex: .py files) are associated with their default program (in my case, Sublime text editor). The program (Sublime) then gets to choose what icon to show. It is possible to manually edit the program's (Sublime's) code to change the icons.

Details: https://superuser.com/questions/178316/how-to-set-an-icon-for-a-file-type-on-mac

(I have done this with Sublime)

_

Why this result is not enough:

I recently switched to the Atom text editor which broke all the icons I had setup in Sublime. In addition, I can't change the icons for Atom like I did in Sublime. The Atom editor's plist file and resources folder is not setup like Sublime. (It is still possible, but rather than renaming/replacing things, Atom actually requires additional code to be written/modified, and I don't have the skill/knowledge to just write the necessary code, and I cannot find any tutorial for learning how)

I (and I believe many others) would prefer that the file icon was set independently from what the default program is. (I mean an Excel file should look like an Excel file whether or not I open it with Microsoft Excel, Numbers, or Sublime)

_

Possible solution:

It might be possible to fix this with an opener-app. If an opener-app is made the default opener for all file extensions, it would be able to set the icon for all those extensions. Then when the opener-app opens a file (for example .py file) it could then open that file with another program (for example Sublime). This way the default program could be changed through the opener-app, (for example, changing the opener-app to have all .py files open the Atom Editor) but, because the opener-app is still technically the default, all the file-icons remain unchanged.

_

Question:

Does anyone know of an app that does this already?

(If you know of any resources on how to create an app like this, I'd be happy to use them to make the app myself, and post the answer here)

  • What version of OS X/macOS are you using? – user3439894 Apr 23 '17 at 18:15
  • OS X Sierra, 10.12.4 – Jeff Hykin Apr 26 '17 at 21:41
0

I was able to create an app for exactly what I was talking about using AppleScript and simply copying most of the Sublime support files.

Setup For yourself

I would not recommend downloading ANYONE's custom-made-easily-could-have-a-virus app. However, I will leave this here for people to look at. Hopefully in the future I'll make this an app on the App Store but that might take awhile. In the meantime, I'd recommend reading the code to make sure it's not malicious.

Download = https://drive.google.com/open?id=0Bz6cPkDulveZdGh2UnlVdU0zbjA

Open script editor (a built-in Mac app)

Choose File -> Open -> where ever you downloaded the app

You will then be viewing the grand total of 5 lines of code I wrote. Change "Atom" to whatever app you want to be your default.

Save the file (command + s).

Move the app to your applications folder.

Find a file you want to change the icon of (lets say a text file). Click the file once (highlight it), press command + i, go to the open with section. Choose DefaultOpener from the list, then click change all.

You will probably have to reboot and toggle the show icon preview button (found in Finder's View Options) a few times for the icons to refresh and get replaced.

I have a few default icons already loaded up ( Text files, cpp files, bash/shell files, python, and about 7 others), but if you want to add your own:

  • Open your applications folder
  • Right click on DefaultOpener
  • Choose show package content
  • Then open the content folder
  • Then open the resources folder
  • Then replace whatever icon with your own icon! (Note your replacement icon will need to be a .icns file)
  • Restart and toggle the show icon preview button a few times

90% of all those other folders and things are support files that were just straight up copied out of the Sublime Text 3 app. You can even open most them and see sublime's name all in them. (There's no actual Sublime app or packages in there, just the basic support files that almost all apps have). (I did this because I still don't really know how the icons are actually set.)

Like I said hopefully I'll be able to turn this in to a legitimate app one day instead of just a thrown together hack. If/When I do I'll post an update here. And if for some reason you want to help me, please do post a comment (I could use all the programming advice I can get).

  • I do not believe Sublime HQ Pty Ltd, would appreciate you redistributing their copyrighted intellectual property, packaged in your app! – user3439894 Apr 26 '17 at 23:06
  • You're right, and if I get any complains I will certainly take it down. I love the Sublime editor and wouldn't want to do anything that would reduce it's value. That said the files I have included are not unique to Sublime, in fact every Mac app that can open a file has nearly identical files. It just happens that I had already modified the Sublime files. There is also no mention of copy right inside any of the files I included (and there is mention of copy right other Sublime files). – Jeff Hykin Apr 27 '17 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .