Cocoa osx:在所有正在运行的应用程序的停靠元素上添加菜单项

发布于 2024-09-18 05:58:54 字数 289 浏览 4 评论 0原文

我正在开发一个 OSX 应用程序,当您单击停靠图标时,我会在显示的菜单上添加一个新的菜单项。 该菜单不适用于我的应用程序,但它必须出现在所有正在运行的应用程序中。

我只找到了这个文档 http://cocoadevcentral.com/articles/000036.php但它添加到自己的应用程序中。

我的应用程序将在 OSX 10.6 或更高版本上运行

I'm working to an application for OSX and I would to add a new menu item on the menu shown when you click on a dock icon.
The menu isn't for my application but it must appear for all running apps.

I've found only this doc http://cocoadevcentral.com/articles/000036.php but it adds to its own app.

My app will run on OSX 10.6 or superior

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

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

发布评论

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

评论(1

棒棒糖 2024-09-25 05:58:54

您无法使用公共 API 来做到这一点。您需要将代码注入 Dock 中。在 10.6 中,注入代码的标准方法是使用 OSAX 加载技巧,如 这篇博文 为此。然后你需要做 Objective-C 运行时黑客来替换该方法,使用 method_exchangeImplementations

无论如何,这是一个棘手的过程。但如果你有意愿,你就可以。 SIMBL 可能(也可能不会)帮助您。

You can't do that with the public API. You need to inject code into the Dock. In 10.6, the standard way to inject the code is to use the OSAX loading trick, described in this blog post for that. Then you need to do Objective-C runtime hackery to replace the method, using method_exchangeImplementations.

Anyway it's a tricky process. But if you have the will, you can. SIMBL might (or might not) help you.

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