简体   繁体   English

为OS X垃圾桶停靠菜单添加菜单项

[英]Add a menu item for OS X Trash dock menu

I want to add a menu item for the OS X Dock Trash icon. 我想为OS X Dock Trash图标添加一个菜单项。 If you right click on it you should be able to see "Open" and "Empty Trash". 如果右键单击它,您应该可以看到“打开”和“空垃圾箱”。 I want to add another option among those. 我想在其中添加另一个选项。 Is there any way i can do that? 有什么办法可以做到吗?

If that is impossible (or at least very hard) to do then is there a way to programmatically empty the trash on OS X from Cocoa application or maybe AppleScript? 如果那是不可能的(或至少很难做到),那么有没有办法从Cocoa应用程序或AppleScript中以编程方式清空OS X上的垃圾?

Thanks. 谢谢。

You can't add menu items to any item in the Dock besides the one for your own application. 除了适用于您自己的应用程序的菜单项之外,您无法将菜单项添加到Dock中的任何一项。 The Trash icon is created internally by Dock.app. 废纸icon图标由Dock.app在内部创建。

Emptying the trash is trivial using AppleScript, though: 但是,使用AppleScript清空垃圾很简单:

tell application "Finder" to empty trash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM