Does any one know how can I remove items that I never use from the context menu?
e.g.: Burn "yadda yadda" to Disk...
I have worked out a solution for this that (so far) works for default Finder right menu context items such as
Burn to disk and
Burn "^1" to disc. This is exactly the goal of OPs request.
There's another breed of context menu bloat that comes from installing Services in the form of Applescript or executable plugins.
Those are simple to get rid of. Whatever they're named, just search your disk for that string. i.e.
Inject Potatos! service will ultimately be found in a file named
Inject Potatos!.<something>. There may be some other shapes and sizes of them but they're the easy problem to solve and out of scope from the OPs post.
For non-english users: This solution is language agnostic. We take advantage of the localization functions that convert default strings + args into localized strings with expanded variables.
I'm not sure about the Objective-C internals of it, but I suspect something similar to this is whats going on..
snprintf(str, 0, "", var1, var2, ..);
There's no format string (i.e. ""), so you always end up with
str being zero length.
If the str is zero length, the localization resolver will walk backwards up the tree to find an ancestor format template that work. As long as you zero out all of the ancestors of that message class - it'll eventually exhaust templates and return a zero-length string to the localization requestor.
The context menu renderer recognizes that it's zero length and omits it from the context menu list items and you get a slimmer context menu.
I know that NSString formatting is different than C, but if you're not an Objective-C guy, and need to think about it in terms of printf, the following too examples are basically the same for the purposes of this exercise.
"Throw ^1 into the ^2"
"Throw %s into the %s", arg1, arg2.
If you make a modification and after restarting Finder it does't seem to be taking affect - you might be modifying a localization string in some other area than the right-click context menu. Revert your change, restart Finder and try again. If you skip this step you may end up modifying something other than the context-menu and not realize it until days later.
Understand that this is basically a hack, it may not work the way you want or expect it to. For what it's worth I've been running with these changes (and more) for at least a couple weeks now and have experienced no ill effects.
First lets look at a 'before' image taken from the OP's post that shows us a typical default Finder context menu full of bloat.
The majority of Apple devices don't even ship with DVD burners anymore, yet there's
Burn "^1" to disc taking up valuable real estate.
Not to mention the equally useless
Copy ^1, etc.
Stripped down as far as I could get it. Bear in mind, if we were selecting a file we would have the default
Open with..menu items.
You don't lose anything unless you omit it.
Things can be made fairly sparse if you wish.
plutil -convert xml1 Localizable.strings, to convert Localizable.strings into a plaintext XML plist file
Open Localizable.strings in a plaintext / code editor (vi, pico, emacs, jed, etc -- TextEdit.app cannot save *.txt files and should be avoided)
Find the value you want to hide. In my case it was 'Burn "^1" to disk' which is key BC50_V2.
<key>BN50_V1</key> <string>Burn to Disc…</string> <key>BN50_V2</key> <string>Burn “^1” to Disc…</string>
My first attempt was to remove the key-value-pair entirely, but this resulted in BC50_V1's string showing up in my menu.
Some format strings will fall back to more generic templates if they exist. In that case you'll have to zero out multiple values.
You can see this behavior with BC50_V2 which falls back to BC50_V1.
Since I wanted to complete get rid of any
Burn... menu entries, I had to zero out BC50_V1 as well.
There are other key value pairs that had multiple fallbacks but they're usually pretty easy to identify as they'll have the same prefix
BC50_ and numerically incrementing suffixes
_V1, _V2, _V..
You can annotate your changes by keeping a copy of the original key/value pair XML fragment inside an XML comment.
I make a copy of the fragment to change, comment out the old fragment with a description and make my modifications to the copy. That way I can easily revert and don't have to use version control or have multiple copies of the file.
<!-- OLD Burn.*to Disc... <key>BN50_V1</key> <string>Burn to Disc…</string> <key>BN50_V2</key> <string>Burn “^1” to Disc…</string> --> <!-- NEW Burn.*to Disc --> <key>BN50_V1</key> <string></string> <key>BN50_V2</key> <string></string>
^<number>. Then number represents the nth argument. If you were feeling especially pimpy you could modify
Burn "^1" to Discto
Archive "^1" forever utilizing an optical disk!.
killall -HUP Finderto restart Finder
open .to open up a Finder window in your current working directory. Right click to open the context menu, verify everything looks good.
You can actually remove native MacOS items from the context menu....but unfortunately, it doesn't appear you can remove the ones you indicated above. Regardless, if you want to take a look, head to
System Prefs > Keyboard > Keyboard Shortcuts > Services
and then uncheck the items you don't want on the menu.
It's unfortunate that you can't remove all of them. But it can at least help you get rid of some of the clutter.