(go back to main page)

Horse Menu Plug-in Development

 

Background
Version 1.6.2 of Horse Menu introduced support for plug-ins. Plug-ins allow any developer to extend the functionality of Horse Menu by writing very simple Cocoa bundles. Plug-ins give the developer a great deal of flexibility. For example, a bundle may include its own nib files and localization. Horse Menu plug-ins do not have to provide the user with system information, like Horse Menu primarily does in its standard form. The plug-in interface simply provides a standard means of getting yourself into a user's Horse Menu.

Requirements
- Horse Menu 1.6.2 or later
- Mac OS X Developer tools
- Basic knowledge of Cocoa programming
- Optional - Join the horse-menu-dev mailing list. See Frequently Asked Questions for instructions.

How to Create a Plug-in
1. From Project Builder, create a new "Cocoa Bundle" project.
2. Click on the "Targets" tab of your project, and view the settings for the default target.
3. Under the "Settings" heading, click the "Expert View" item. Modify the "WRAPPER_EXTENSION" property, setting its value to "HMDatasource". This is the file extension that all Horse Menu plug-ins must have.
5. Create a principal class for your project, either by using Interface Builder, importing files, or
creating a new Objective-C class within Project Builder.
6. Click on the "Targets" tab of your project, and view the settings for the default target.
7. Under the "Info.plist Entries" heading, click the "Expert View" item. Modify the "NSPrincipalClass" property, setting its value to the name of your principal class.
8. Begin coding! Your principal class must conform to HMDatasourceProtocol100.
It is strongly recommended that you download the example code listed below.

Installing a Plug-in
1. Control-click on the Horse Menu application in the Finder, and select "View Package Contents".
2. Place your plug-in into the Contents/Resources/PlugIns/ directory.
You must relaunch Horse Menu for the plug-in to be available. You will also need to add the plug-in to your menu using Horse Menu's preferences.

Example Code
If you would like to download a sample plug-in project, click here. This sample is a very basic module that displays the current time, as well as graphs of Apple's and Motorola's stock performance. It illustrates the flexibility Horse Menu affords, such as being able to display images within the menu. Below is a screen shot of the plug-in in action.