sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Support for Windows 11 IExplorerCommand

Open sponge opened this issue 3 years ago • 20 comments

Problem description

With Windows 11, the new Explorer context menu no longer exposes any old style shell extensions. Sublime currently uses a registry entry to create "Open with Sublime Text" in the classic context menu, but this requires an extra click on "Show more options" before using it.

Preferred solution

Support IExplorerCommand and ship Sublime with a Sparse Manifest in order to allow "Open with Sublime Text" to appear on the new context menus. MS has a page detailing this here: https://blogs.windows.com/windowsdeveloper/2021/07/19/extending-the-context-menu-and-share-dialog-in-windows-11/

Alternatives

While the existing menu option can be accessed through Shift+F10, or the Show More Options option, its an extra click for something I'm doing fairly frequently.

There are third party solutions to restore the original context menu and all of its warts, but hopefully more programs will update similarly as Windows 11 begins to roll out.

Additional Information (optional)

Posted a thread with some screenshots and some further explanation on the ST forums before being directed here: https://forum.sublimetext.com/t/open-with-sublime-text-in-windows-11/60895

Note that W11 is currently available to people in the "Release Preview Channel" which means that the builds are generally final, or close to it, compared to the Dev or Beta channels.

sponge avatar Sep 28 '21 21:09 sponge

Windows 11 is now officially released since 10 days...

shivan avatar Oct 15 '21 09:10 shivan

Yeah it'd be nice to have this implemented.

childsd3 avatar Nov 03 '21 01:11 childsd3

Any progress in this regard? I'm eager to get this feature :) For me, it's very inconvenient that I changed to VS Code to edit single files...

dannyyy avatar Apr 14 '22 06:04 dannyyy

Any updates on this issue? I really enjoyed bypassing the Windows "Open With" dialog when opening an unknown file. It's an annoyance that I now need to use VS Code because even that starts faster than navigating to the "Shift + F10" context menu...

JannesStroehlein avatar Aug 08 '22 08:08 JannesStroehlein

I also want this. It is very annoying when opening unknown file extensions that are text files. Going through many unnecessary steps now. I would also like to see a "Open in Sublime Text" next to the "Open in Terminal", like the one that was in the root of the old context menu.

Yrlish avatar Nov 05 '22 10:11 Yrlish

It's 2023 and Windows 11 is definitely a thing, can we have "Open in Sublime" on the context menu please 😢

Tmp2k avatar Jun 28 '23 10:06 Tmp2k

FWIW, NPP does this right out of the box on install. might want to peep that source for getting this done. can't have NPP showing us up now, can we!? 😆

iansebryk avatar Jul 03 '23 19:07 iansebryk

I was able to fix this with Start All Back and enable Windows 10 Context Menu. But surprised Sublime hasn't fixed this for Windows 11 yet without a workaround:

https://www.startallback.com/

JordashTalon avatar Aug 16 '23 17:08 JordashTalon

It isn't "fixed", because it's not a bug. ST just doesn't support the new style of context menu.

deathaxe avatar Aug 16 '23 18:08 deathaxe

It isn't "fixed", because it's not a bug. ST just doesn't support the new style of context menu.

I guess I'm surprised Sublime text hasn't added support for the new style of Context Menu, it's kind of a deal breaker not to have it, was about to switch to VSCode since that has built in support for Windows 11 Context Menu

JordashTalon avatar Aug 16 '23 18:08 JordashTalon

support for Windows 11 Context Menu

Well, if that' such an important productivity boosting feature you can't live without, than you probably should? I'd argue, ST is still faster up and running even with the extra context menu switch.

deathaxe avatar Aug 16 '23 18:08 deathaxe

I prefer Sublime over VS Code but useful features like this are main decision points between the two, at least with the workaround of StartAllBack I can stick with Sublime for now.

JordashTalon avatar Aug 16 '23 18:08 JordashTalon

I don't use Explorer for productivity reasons, thus I never see that menu. Hence it is of no priority for me - just to also state another point of user's view.

deathaxe avatar Aug 16 '23 18:08 deathaxe

Any traction here? I'm suffering under Windows 11 now...

FWIW, this is an excerpt of the linked microsoft blog post:

“Universal openers,” like technical text editors, should register to handle * so they will always be offered as an “Open with” option. They should also explicitly register for any filetypes they are optimized to handle.

(Emphasis mine)

Still might require UWP, but it would serve as a sensible default if not, or at least it sounds quite reasonable to me.

So in this case SLT should register for * and additionally for every file type that is directly supported, I'm assuming syntax highlighting support would qualify for that and that they have some kind of plan (probably sorting by specificity), though I'm unsure if that is possible with SLT plugins and should probably be a minor goal.

E14 avatar Dec 30 '23 14:12 E14

IIRC, registering as "Open With..." is the primary strategy of sublimehq. It is however unrelated with supporting IExplorerCommand.

To register ST for all file types, just add the following registry key:

; Register Sublime Text for "Open With..."
; https://docs.microsoft.com/en-us/windows/win32/shell/app-registration
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\OpenWithList\sublime_text.exe]

sublime_text.exe should already have beeen registered by the installer, which adds the following registry keys:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe]
"FriendlyAppName"="Sublime Text"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\DefaultIcon]
@="\"C:\\Program Files\\Sublime Text\\sublime_text.exe\",1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\sublime_text.exe\shell\open\command]
@="\"C:\\Program Files\\Sublime Text\\sublime_text.exe\" \"%1\""

deathaxe avatar Dec 30 '23 14:12 deathaxe

Just as a side note and in case you use a third-party software like https://github.com/ikas-mc/ContextMenuForWindows11 to add the context menu item manually; I recently created an icon that matches the style and colors of the built-in menu items. So I thought why not to share it:

Dark mode:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 448">
    <rect stroke="#e0dfdf" stroke-width="28" fill="none" x="14" y="14" width="420" height="420" rx="84"/>
    <path stroke="#4cc2ff" stroke-width="28" fill="none" d="m 344.92773,60.366821 c -0.41046,0.0377 -0.83661,0.121511 -1.27148,0.259767 L 104.31641,136.51916 c -2.35799,0.74812 -4.398149,2.82414 -5.482428,5.27736 C 98.315886,142.64006 98,143.68687 98,144.92737 v 77.57422 0.5332 c 0,1.2405 0.315886,2.28708 0.833982,3.13086 1.084279,2.4532 3.124438,4.52922 5.482428,5.27734 l 101.65038,32.23829 -101.65038,32.2246 C 100.83041,297.01188 98,301.03197 98,304.86096 v 77.56055 c 0,3.83599 2.83041,6.05522 6.31641,4.94922 l 239.33984,-75.87891 c 3.07325,-0.97701 5.63554,-4.22757 6.19336,-7.61523 C 349.94919,303.41886 350,302.93558 350,302.4137 v -77.57423 c 0,-3.82899 -2.83041,-7.84907 -6.31641,-8.95507 L 243.07227,183.98791 343.65625,152.09143 c 3.479,-1.106 6.30274,-5.12608 6.30274,-8.95507 V 65.575809 c 0,-3.356503 -2.15797,-5.472741 -5.03126,-5.208988 z"/>
</svg>

Light mode:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 448">
    <rect stroke="#555" stroke-width="28" fill="#fafafa" x="14" y="14" width="420" height="420" rx="84"/>
    <path stroke="#0078d4" stroke-width="28" fill="none" d="m 344.92773,60.366821 c -0.41046,0.0377 -0.83661,0.121511 -1.27148,0.259767 L 104.31641,136.51916 c -2.35799,0.74812 -4.398149,2.82414 -5.482428,5.27736 C 98.315886,142.64006 98,143.68687 98,144.92737 v 77.57422 0.5332 c 0,1.2405 0.315886,2.28708 0.833982,3.13086 1.084279,2.4532 3.124438,4.52922 5.482428,5.27734 l 101.65038,32.23829 -101.65038,32.2246 C 100.83041,297.01188 98,301.03197 98,304.86096 v 77.56055 c 0,3.83599 2.83041,6.05522 6.31641,4.94922 l 239.33984,-75.87891 c 3.07325,-0.97701 5.63554,-4.22757 6.19336,-7.61523 C 349.94919,303.41886 350,302.93558 350,302.4137 v -77.57423 c 0,-3.82899 -2.83041,-7.84907 -6.31641,-8.95507 L 243.07227,183.98791 343.65625,152.09143 c 3.479,-1.106 6.30274,-5.12608 6.30274,-8.95507 V 65.575809 c 0,-3.356503 -2.15797,-5.472741 -5.03126,-5.208988 z"/>
</svg>

ico_files.zip

The linked app currently doesn't support different icons for light and dark mode, so you'd need to decide for one of them.

My config
{
    "title": "Mit Sublime Text öffnen",
    "exe": "\"C:\\Program Files\\Sublime Text\\sublime_text.exe\"",
    "param": "\"{path}\"",
    "icon": "\"C:\\Icons\\sublime_text_dark.ico\"",
    "index": 0,
    "acceptDirectory": false,
    "acceptExts": "*",
    "acceptFileFlag": 1,
    "acceptFileRegex": "",
    "acceptMultipleFilesFlag": 0,
    "pathDelimiter": "",
    "paramForMultipleFiles": ""
}

I guess that if/when the ST devs eventually add support for the Windows 11 menu, they will probably use the "official" icon with the orange "S", but I kinda like how the icon looks with the standard Windows 11 style.

context_menu

jwortmann avatar Dec 30 '23 15:12 jwortmann

IIRC, registering as "Open With..." is the primary strategy of sublimehq. It is however unrelated with supporting IExplorerCommand.

To register ST for all file types, just add the following registry key:

; Register Sublime Text for "Open With..."
; https://docs.microsoft.com/en-us/windows/win32/shell/app-registration
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\OpenWithList\sublime_text.exe]

That doesn't seem to have done anything though, maybe the blog references a different registration feature or I'm misunderstanding something.

E14 avatar Dec 31 '23 04:12 E14

This registry key makes sure to add ST to the list of available applications in the "Open With..." dialog.

grafik

You still need to open the "Choose Other App..." dialog, select Sublime Text and open a file for Sublime Text to get added to the file's Open With... list as favourite.

grafik

deathaxe avatar Dec 31 '23 13:12 deathaxe

I see, so that only saves me the once-per-windows-install looking for the sublime exe

E14 avatar Dec 31 '23 18:12 E14

I have also been missing this feature since I upgraded to Windows 11.

bastian-weber avatar Apr 19 '24 07:04 bastian-weber