views:

61

answers:

3

Hi,

I am fluent in C++, Java, and Python and can pretty much pick up any other skill given enough time (no surprise there, I'm sure 99.9% of the people reading this share the same ability).

I have an idea for a small app for Mac OS X and I was wondering what technology I should employ/learn to get it working. I need some minimal OS X integration to get this done right.

I'm thinking I should probably use objective-C with Cocoa, but if this could be done with some Java library I would prefer that.

My Mac OS X application would do the following:

  • Be able to intercept all keyboard and mouse input regardless of active (focused) application and select to either block it (effectively disabling input) or act on receipt of certain keyboard shortcuts.
  • Have a Mac OS X menu bar item (at the top right of the screen next to the battery, network adapter, etc.)
  • Be able to occupy the entire screen at times (with some OpenGL canvas to display animations, much like a screen saver does)
  • Have sound.

What technologies would you recommend?

+2  A: 

If you are well versed in C based languages, Cocoa is an excellent place to start and would probably be the easiest for the tasks you describe. Start here for cocoa: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html

Python has some excellent support as well, you can look here for modules that may contain what you need: http://docs.python.org/library/mac.html

If you would prefer Java, here is where I would start looking for the functionality you need: http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html

I'm not sure honestly which to recommend, I can just say cocoa will probably have the best support for any integration you may need.

MaQleod
+2  A: 

My Mac OS X application would do the following:

  • Be able to intercept all keyboard and mouse input regardless of active (focused) application and select to either block it (effectively disabling input) or act on receipt of certain keyboard shortcuts.

CGEventTap.

Have a Mac OS X menu bar item (at the top right of the screen next to the battery, network adapter, etc.)

NSStatusItem.

Be able to occupy the entire screen at times (with some OpenGL canvas to display animations, much like a screen saver does)

Any NSView can do this, but for OpenGL, you'll want NSOpenGLView specifically.

Alternatively to the usual full-screen method, you might prefer to put the view in a window at the screen-saver level. Try both ways and see which works best for you.

Have sound.

NSSound.

Peter Hosey
+1  A: 

This started out as a comment but got too big.

I think you could do most of this with Java - menu icons, for instance, can be done through the SystemTray API which puts them in the relevant place on Windows or OS X. A previous specific answer on this : http://stackoverflow.com/questions/1970876/system-tray-menu-extras-icon-in-mac-os-using-java

The key question is whether Java has APIs to grab 'raw' events from the OS, or only when focus is on the application. The standard KeyListener, for instance, is linked to a component with focus.

However, given the nature of the application, I'd suggest going with Cocoa. This would also allow you to use Core Animation (a higher level abstraction over Quartz / OpenGL).

JulesLt