Monday, 7 October 2013

How to add an icon to the Sublime Text context menu in Windows

Currently the Sublime Text installer doesn't add an icon to the 'Open with Sublime Text' context menu that appears when right-clicking a file. I've only recently switched over to Sublime from Notepad++ which does have the icon and it's just a nice thing to have because it allows you to spot it in the menu faster.

No icon

In order to add the icon we'll need to play around in the registry a bit. I wouldn't recommend proceeding if you aren't confident editing the registry as you can totally screw up your computer if you change the wrong thing. This tutorial was made using Windows 8 but I expect the process is very similar if not identical in Windows Vista and Windows 7.

Here are the steps to add the icon:

  1. Open the registry by hitting Start and typing regedit.

    Regedit
  2. Hit Ctrl+F to open the find dialog and search for 'open with sublime text'.

    Find
  3. You are looking for a key (folder icon) with the name 'Open with Sublime Text' within Computer\HKEY_CLASSES_ROOT, you can see where you are by looking at the status bar in the bottom-left of the window. Hit F3 to find the next item matching the search. Mine was located in Computer\HKEY_CLASSES_ROOT\*\shell\.

    Location
  4. Right-click on the key and select New > String Value.

    New
  5. Name the new string value 'Icon', then double-click on it and enter the path of your Sublime Text executable.

    Icon added
  6. Close regedit and you should now see the icon in your context menu!

    Done