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

I love it when negative results and outliers win

Recently, we at the University of Oregon were treated to a terrific seminar from Tom Reimchen. His has spent a career looking at the evolutionary traits of tiny stickleback fish in lakes on Haida Gwaii, off the coast of British Columbia. His results were sweeping and impressive, as results often are after decades of work – he has found over and over that a few morphological aspects of stickleback in lakes near each other varied based on their small lake environment and resulting selective pressures. Basically, long spines and tough protective plates protect from attack, but at a fitness (speed and evasion) cost. Murkier lakes held sneak attacks from predators and thus tough protection was key; clear water allows stickleback to see attacks coming, so speed and evasion win the day. A beautiful story.

But studying many different lakes with many different chemistries, conditions and myriad other covariates makes for nuanced conclusions – most skeptical scientists hearing these results immediately want to know if there is anything more simple that might explain. Which is why Reimchen really struck me with an answer to a good question. An audience member was curious about fitness costs of building tough plates, and if these structures appeared even when resources like Ca and P were limiting – these are necessary to build bony plates. Over the years Reimchen and colleagues of course collected many different environmental parameters, including pH and Ca concentration. Almost all of these lakes were strongly Ca-deficient, meaning that it would be really hard to build bony plates, but if the water was murky and if the right predators were present, the stickleback always seemed to be well protected by these chemically-expensive structures. Closer to the ocean, however, splash and surge from salty water makes for high Ca conditions, and the researchers found that these lakes near the ocean were no more likely to hold heavily-plated stickleback than those inland, and that visibility and predation explained most of the variability.

To a researcher trying to find out if predation is driving prey morphology, this negative result (bony structures are not explained by resource availability) likely comes as a relief – it supports your alternative hypothesis. But stoichiometry wants to explain so much in the natural world that it is really cool to see results that defy such a unifying principle.

Maybe Josh Schimel’s book, Writing Science is the reason I latched onto this result. I absolutely love this book and it is changing the way I write in a big way – but also the way I think about science. Schimel goes to great length early in the book to argue for paying close attention to outliers and ugly data points, since outliers are often “…more novel, exciting, and important science.” This chapter hit me hard – I’m a data analyst for the most part and I almost always try to ignore outliers. It comes easy for me to think that samples were mishandled, poorly sequenced, or in other ways discountable. Outliers tend to look ugly, and negative results might mean that my data are not clean enough to see the relationship I assume is there. But Schimel’s book, along with Reimchen’s talk, have helped me to take a step back when data are not explained cleanly – to look even deeper when a few samples are uncooperative. As a graduate student studying statistics, I committed to memory the accepted rules for ignoring outliers in a dataset. The rules generally revolve around an assumption that points represent replicates from the same population; discount them if you have reason to believe they don’t. Now I am rethinking this approach, realizing that instead of discounting, I should more thoroughly investigate why a point is so far away from expectation.