## Add icon in Windows Context Menu

### Add icon in Windows Context Menu

Hello,

I think it would be nice and easier to see if you added the application icon to the left of the context menu label, like Notepad++ does for example.
Attached screenshot.
Attachments
idea.jpg (11.04 KiB) Viewed 9323 times
Francisc

Posts: 55
Joined: Thu Sep 22, 2011 7:14 pm

### Re: Add icon in Windows Context Menu

You can do this easily by adding an Icon entry to the registry.

Code: Select all
reg add "HKLM\Software\Classes\Applications\sublime_text.exe\shell" /t REG_EXPAND_SZ /v "Icon" /d "c:\path\to\sublime_text.exe,0"

I use the portable version so I'm not sure that is the exact location the installed version of sublime text is registered at.
Remember, registry editing is risky blah blah blah
atomi

Posts: 345
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

### Re: Add icon in Windows Context Menu

Clever, thanks atomi.
Francisc

Posts: 55
Joined: Thu Sep 22, 2011 7:14 pm

### Re: Add icon in Windows Context Menu

The Icon doesn't show.

The key is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\shell

And the path to sublime_text.exe is correct.

Any idea why that didn't work?
Francisc

Posts: 55
Joined: Thu Sep 22, 2011 7:14 pm

### Re: Add icon in Windows Context Menu

Francisc wrote:The Icon doesn't show.

The key is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\shell

And the path to sublime_text.exe is correct.

Any idea why that didn't work?

I really don't have any idea how the installed version of Sublime sets up it's file associations.
Instead of Icon it might be DefaultIcon.. you might have to google this sorry.
I don't add icons for sublime verb, I set sublime to replace notepad.exe - wish I could help more.

Edit: this might get you going in the right direction
http://www.winhelponline.com/blog/chang ... and-vista/
What I would do is search for the string "Open with Sublime Text 2" in the registry and add a DefaultIcon entry under that registry key (should be in HKLM).
atomi

Posts: 345
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

### Re: Add icon in Windows Context Menu

Hi Atomi, this is what I did last night:

reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "path-to-install-dir\sublime_text.exe,0"

I compared what other files that had icons did and took it from there.

Thanks.
Francisc

Posts: 55
Joined: Thu Sep 22, 2011 7:14 pm

### Re: Add icon in Windows Context Menu

Francisc wrote:Hi Atomi, this is what I did last night:

reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "path-to-install-dir\sublime_text.exe,0"

I compared what other files that had icons did and took it from there.

Thanks.

Nice. Thanks for posting back here.
It's better to put it in HKLM as HKCR is just a copy of HKLM.
The key should be "HKLM/Software/Classes/*/shell/Open with Sublime Text 2"
But glad you got it working.
atomi

Posts: 345
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

### Re: Add icon in Windows Context Menu

OK, I'll make the changes.
The reason I added it there was that "Open with Sublime Text 2" was there in the first place and no where to be seen in the Local_Machine.
Francisc

Posts: 55
Joined: Thu Sep 22, 2011 7:14 pm