Live Fast, Code Hard, Die Young

Posts tagged ‘tortoisesvn’

Fixing the missing icons in TortoiseSVN

image

I’m using TortoiseSVN for source control both at work and at home. Lately I’ve been having some problems with it though because the icon overlays that show the status of files are not displayed. That kind of takes away one of the great features of the program so it quickly drove me nuts.

It turned out that it was not hard to fix. After some searching I found out that the problem is that Windows only supports a maximum of 15 registered overlay icons. Of those it uses 4 itself so that leaves us with 11 icons to play with. What happens if more icons are registered? Well, those extra icons are simply not shown. According to the TortoiseSVN FAQ this is taken into consideration when Tortoise is deciding which icons to use and I’ve never had any problems with it until now. Maybe it is not working as intended when running in Windows 7 (64-bit)?

So how does Windows decide which icons to use? Well there is a special key in the registry where everything can be found. It’s under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers.

This is how my registry looks:

image

Windows reads this list in alphabetical order which is kind of lame. I have some icons from Dropbox, some from Tortoise and some other that I suspect belong to Windows or Office. It seems that this list of 15 icons should work but it doesn’t. It’s more likely that only 11 of these icons are used because I’m missing the most common Tortoise icons (Modified and Normal) which happen to fall just outside the range.

The great part here is that each of these keys only contains a GUID which tells Windows where to lookup the actual icon information. In fact, we can change the names of the keys without breaking anything which gives us an easy way of rearranging the list!

This is a simple way of fixing it and making sure that the Tortoise icons gets a higher priority:

image

As you can see I renamed the icon identifiers and prefixed them using numbers which will ensure they are sorted before the other icons. I skipped the “TortoiseUnversioned” icon because it’s usually not of interest to me. Maybe I could skip some of the other icons too but I wanted to make sure it worked first.

After doing this little rename operation you have to restart your computer (yea, it’s Windows isn’t it?) and then the icons should show up nicely again. Quite sweet isn’t it…

image

It’s working! 🙂