Reputation: 2192
I have customized the contextual menu for my Cocoa application such that only certain items are visible. In spite of my customization, I found that the system adds a menu item -- "Add to iTunes as a spoken track".
I tried removing this item from the menu but somehow, I am unable to get the control. Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts? I hate doing that since I will then have to restore it for the user.
Upvotes: 12
Views: 2239
Reputation: 27373
In my experience, Apple's default items trigger off of the exact title of the menu. For example, I have a toy app with an NSMenu that I am creating entirely in code (no nib). I find that the View menu gets an extra item (for full screen) if I initialize it as follows:
NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View"];
However, if I put an extra space into the name, then Apple doesn't mess with it:
NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View "];
Upvotes: 0
Reputation: 2143
You can control the contents of these menus (system-wide) by using Preferences.
See System Preferences > Keyboard > Keyboard Shortcuts > Services > Text
Upvotes: 63
Reputation: 34195
Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts?
Don't fight with The System; those Service items are supposed to appear on every context menu, as specified in the System Preferences. It even appears on the context menu of Safari which I'm using to view this post right now. Yes I agree that having "add to iTunes" enabled by default is a poor choice on the part of Apple, but that's life.
Maybe the user has his/her own service item s/he installed say as an Automator action. In that case the user probably doesn't want to have it removed.
Upvotes: -8