系统正在将不需要的项目添加到我的应用程序中的自定义上下文菜单中

发布于 2024-12-13 13:35:15 字数 199 浏览 3 评论 0原文

我已经为 Cocoa 应用程序定制了上下文菜单,以便只有某些项目可见。尽管我进行了自定义,但我发现系统添加了一个菜单项——“作为语音曲目添加到 iTunes”。

我尝试从菜单中删除此项目,但不知何故,我无法获得控制权。有没有办法可以删除此项目,或者我是否必须编写 AppleScript 来禁用键盘快捷键下的 iTunes 选项?我讨厌这样做,因为我必须为用户恢复它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦醒灬来后我 2024-12-20 13:35:15

您可以使用首选项来控制这些菜单(系统范围)的内容。

请参阅系统偏好设置 > 键盘 > 键盘快捷键 > 服务 > 文本

You can control the contents of these menus (system-wide) by using Preferences.

See System Preferences > Keyboard > Keyboard Shortcuts > Services > Text

七七 2024-12-20 13:35:15

根据我的经验,苹果的默认项目是根据菜单的确切标题触发的。例如,我有一个带有 NSMenu 的玩具应用程序,我完全用代码(没有笔尖)创建它。我发现如果我按如下方式初始化视图菜单,它会获得一个额外的项目(用于全屏):

    NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View"];

但是,如果我在名称中添加一个额外的空格,那么苹果不会弄乱它:

    NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View "];

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 "];
2024-12-20 13:35:15

有没有办法可以删除此项目,或者我是否必须编写 AppleScript 来禁用键盘快捷键下的 iTunes 选项?

不要与系统对抗;这些服务项目应该出现在每个上下文菜单上,如系统偏好设置中指定的那样。它甚至出现在我现在用来查看这篇文章的 Safari 的上下文菜单上。是的,我同意默认启用“添加到 iTunes”对于 Apple 来说是一个糟糕的选择,但这就是生活。

也许用户有他/她自己安装的服务项目,例如作为自动化操作。在这种情况下,用户可能不想将其删除。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文