简体   繁体   English

Mac OSx:将项目注入Finder的上下文菜单

[英]Mac OSx: Injecting item to Finder's Context Menu

In 10.5, we have native support for context menu plugins. 在10.5中,我们对上下文菜单插件有本机支持。 This allows us to add items on runtime, and adding different menus for different file types. 这允许我们在运行时添加项目,并为不同的文件类型添加不同的菜单。

But since 10.6 and higher, we have context menu services which don't allow subMenus, and don't help if we wanted to add different items in context menu on runtime based on file type of location. 但是从10.6和更高版本开始,我们有了不允许使用subMenus的上下文菜单服务,如果我们想在运行时根据位置的文件类型在上下文菜单中添加不同的项目,则无济于事。

This has lead me to do some code injection into Finder(like DropBox has done), but I'm kind of new to this particular task, but I'm willing to do it. 这导致我向Finder做了一些代码注入(就像DropBox已经完成的那样),但我对这个特定的任务有点新意,但我愿意这样做。 Does any one can give me a starting point. 有没有人可以给我一个起点。

Thanks in anticipation. 谢谢你的期待。

You can start with mach_star . 你可以从mach_star开始。 mach_star is an open-source code suite for suppressing, replacing and/or extending Mac OS X functionality at a very low level. mach_star是一个开源代码套件,用于以非常低的级别抑制,替换和/或扩展Mac OS X功能。 Its principal components are mach_override (replace and/or extend existing functions at runtime) and mach_inject (dynamically load your code into a running process). 它的主要组件是mach_override(在运行时替换和/或扩展现有函数)和mach_inject(将代码动态加载到正在运行的进程中)。

Up to to the OS X 10.9.x only injecting code to Finder process via mach_inject was a solution (and even Dropbox did that). 直到OS X 10.9.x,只有通过mach_inject向Finder流程注入代码才是一个解决方案(甚至Dropbox也是如此)。 However since 10.10 there are Finder plugins, which can customize context menus, add buttons to Toolbar and put overlays over the file icons. 然而,自10.10以来,有Finder插件,可以自定义上下文菜单,向工具栏添加按钮,并在文件图标上添加叠加。

Update: since OS X 10.11 code injection will not work at all due to System Integrity Protection. 更新:由于系统完整性保护,OS X 10.11代码注入完全不起作用。 So only Finder Sync plugin. 所以只有Finder Sync插件。

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

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