Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the keyword for Mac OS X Service-like applications?

Tags:

macos

cocoa

I need to build an application on Mac OS X that runs on the background, windowless and provides a status icon in the top-right corner of the menu bar. It should launch on a specific action initiated by the user (not at system start up) and interact solely through the status bar icon.

On Windows this is very close to Services, on Unix - to daemons. What should i search for in Mac documentation? I just need a few keywords.

like image 803
Inso Reiges Avatar asked Dec 24 '09 10:12

Inso Reiges


People also ask

What is a Mac OS service?

You may or may not have noticed a menu option for apps in macOS called Services. Services is something that will let you use a feature from another app – without having to open that app. So essentially, it is a way to access shortcuts that will allow you to do small tasks quickly.

How do I create a service in OSX?

To create a service workflow that runs a scriptLaunch Automator, found in /Applications/ . Create a new Automator document. When prompted, choose a document type of Service and click Choose. At the top of the Automator document, configure the service.


2 Answers

Nothing so strictly defined. Mac OS X considers the parts of your question to be separate concepts:

  • The icon on the right side of the menu bar (i.e., in the status bar) is a status item. Any application can create any number of them, using the NSStatusItem class.
  • An application with no Dock tile is usually an agent. An application with no UI at all is a daemon. A status item counts as UI, so an application with only a status item is an agent. The typical way to make an agent (with or without a status item) is to set LSUIElement to the string "1" in its Info.plist.

Having never programmed DOS or Windows, I have no idea what “resident” means to you. On Mac OS X, it simply means “in RAM”, which any running application at least partially is.

like image 72
Peter Hosey Avatar answered Oct 20 '22 21:10

Peter Hosey


Services on Windows are not at all connected to this concept. A status item-only utility is the simile for something running solely from the system tray (like one of those delightfully useless nuggets that you get for seemingly every trackpad, audio card or GPU that you have the bad luck to be outfitted with). Services are just background programs a) without UI and b) that support or provide system or application functions. Dozens flare in and out of existence as you use Windows, mostly at startup, and most of them provide completely abstract functionality, such as providing network APIs for other services to use.

That said, Peter's answer is likely what you meant to find out, but I think it should be spelled out that it's not necessarily connected to the equivalent of Windows Services. (If you're looking to build such a thing on OS X, look up daemons and launchd.)

like image 23
Jesper Avatar answered Oct 20 '22 20:10

Jesper