4

In 10.5, we have native support for context menu plugins. 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.

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. Does any one can give me a starting point.

Thanks in anticipation.

Munir Ahmed
  • 105
  • 6
  • possible duplicate of [How to Write OS X Finder plugin](http://stackoverflow.com/questions/1294335/how-to-write-os-x-finder-plugin) – nos Apr 18 '14 at 20:38

2 Answers2

5

You can start with 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. 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).

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
  • Is there any example on how to use mach_star ? I couldn't figure out how mach_inject could be integrated in my Cocoa app. Thanks ! – Laurent Crivello Feb 24 '12 at 11:46
  • Download code from https://github.com/rentzsch/mach_star and run DisposeWindow+Beep_Injector in root mode. Now check you finder's open files and ports. – Parag Bafna Feb 24 '12 at 11:55
2

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). However since 10.10 there are Finder plugins, which can customize context menus, add buttons to Toolbar and put overlays over the file icons.

Update: since OS X 10.11 code injection will not work at all due to System Integrity Protection. So only Finder Sync plugin.

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48