Life is too short for hideous icons!

I generally love the clean, thoughtful layout that makes Macs different from everything else. They’re great at that … with one major, terrible exception. And by that I mean their default blue, shadowy, 3d-for-no-reason folder icons. They are everywhere, and they destroy all efforts to stylize (or destylize) your desktop view.

GenericFolderIcon

I fixed this a while ago when I bought my current computer, but updating to Mavericks undid all of my efforts. Clearly I had to come up with a reproducible way to fix it.

There are two ways to do this:

The slow dumb way:

  • download or design a folder icon you like. (I used this one – it’s clean and beautifully semitransparent). The icon should have a .icns extension.
  • for every folder in your computer:
    • use the get info option to manually change it.
  • and then repeat every time you make a new folder for as long as you choose to own a mac.

The slightly better, long-term way:

  • download or design your icon
  • replace the default icon images that your computer uses to create new folders.
    • open Terminal and do this:

cd /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources; open .

  • replace every one by hand – there are dozens – and tell your computer that you really do intend this crazy action.

That’s what I did the first time, but repeating something so laborious is goofy. So this time I wrote a simple python program to do it.

The fun python way:

  • go to that same Resources directory and back up all of your icon images in case things go awry.
  • create a temporary working folder (like on your desktop). I’ll call it ~/Desktop/replaceIcons
  • make a quick list of the icons you need to replace. Since Mac labels the important folder icons with the word Folder, this is easy to automate with a single command:

ls *Folder* > ~/Desktop/replaceIcons/fileNames.txt (wordpress converted the > to > – bug).

  • That just dumped a text file into the temporary working directory that lists all of the names you need to replace. Quickly open that to check it and also remove the last empty line, and save it.
  • put your icon in the same folder, and also put this python script into the same folder:
\#!/usr/bin/python
# wordpress inserted a backslash in the first line. don't copy that.
# Name this script 'replaceIcons.py'

import sys
import shutil
import os

def changeNames(fileNameList, fileToCopy):
  f = open(fileNameList, 'rU')
  text = f.read()
  textSplit = text.split('\n')
  path = os.getcwd() + '/'
  pathFileToCopy = path + fileToCopy
  for file in textSplit:
    pathFile = path + file
    print pathFile
    shutil.copy(pathFileToCopy, pathFile)
  f.close()

def main():    
  if len(sys.argv) == 1:
    print 'usage: ListOfNamesFile IconToCopy\n'
    sys.exit(1)

  else: 
    changeNames(sys.argv[1], sys.argv[2])    
    print 'done\n'
    sys.exit(1)

if __name__ == '__main__':
  main() 
  • Then open up your terminal, navigate to your temporary working folder cd replaceIcons
  • make the script do its simple magic:

python replaceIcons.py folderNames.txt myIcon.icns

Now you should have many icons with the same names as the ones you hope to replace. Go back to the Resources folder and drop all of your new icons into the folder. Mac will ask you if you really do want to do that, and click the box that says ‘apply to all’, and click ‘replace’.

Voila! Now just restart your computer and your icons will no longer make your eyes bleed. If you use Dropbox, this will not change your shared folders (which is good for me so that I can clearly identify the folders that others can also see).

I assume that this can all be done with just a few lines of code, and if that’s true I welcome suggestions. Also, several of the manual steps can be done in python as well, but I didn’t really want to mess with permissions in a script like this.

I hope it works for you. Here is my much improved view:

desktopView

finderView

Advertisements