Sublime Forum

Associating ST3 to the "Open With..." Finder context menu for folders on OS X

#1

I found a way to allow ST3 to show up in the “Open With…” Finder context menu when right-clicking on a folder and it would be great (if it makes sense to you as a good idea) to make this change in a future release of ST3.

You can associate files/extensions with Sublime Text just using the Finder GUI (default applications) but I couldn’t find out how to associate folder actions this way. I rely on this workflow frequently to open up a whole directory tree in ST3 from Finder and prefer it to using Automator.app to create a custom “Service” or looking for plugins.

Anyway, all that I did was modify the Info.plist file in Sublime Text.app and add this XML:

<dict> <key>CFBundleTypeName</key> <string>File or Folder</string> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>public.data</string> <string>public.folder</string> </array> </dict>

Then, rebuilt the LaunchServices database with this:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Finally, reset Finder (or just reboot the whole machine).

Works great! Although it would be better if this customization was embedded into an official release as I am sure my customization will be blown away with every ST3 update and codesign now reports that Info.plist is “not bound” (although everything still works fine).

What do you think?

1 Like