Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6971709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:52:29+00:00 2026-05-27T16:52:29+00:00

I am building a Cocoa Mac application that runs in the background but has

  • 0

I am building a Cocoa Mac application that runs in the background but has a main window.

To make it run in the background I’ve set “Application is background only” to “YES”.

I built a system tray:

system tray

If you close the main window, you can re-open it by clicking “open”.

I have however some issues with the layering of windows:

  • When I start the application, the main window opens however it appears in the background, behind any other windows or applications I have open at the time.
  • Clicking on “open” doesn’t bring the window to the foreground. It opens it correctly if it was closed, however it stays behind any windows.
  • Clicking on preferences or about has the same issue. It opens the correct window but it appears behind any other windows.
  • On my main window there is a textfield. I can click on it, the cursor blinks as if I am ready to type. But when I type it actually types in some other background window! For example if I have TextWrangler open in the background, it will type there instead of the textfield…

Here is my code for handling the “open”:

- (IBAction)show:(id)sender {
    [NSApp activateIgnoringOtherApps:YES];
    [window makeKeyAndOrderFront:sender];   
}

Note that IF I set “Application is background only” to “NO” (which means I have a dock icon appearing), then clicking on “open” brings the window to the foreground as expected. And typing in the textfield works as expected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:52:30+00:00Added an answer on May 27, 2026 at 4:52 pm

    Background only (LSBackgroundOnly YES) is intended for faceless background applications, Accessory (LSUIElement YES) is intended for background applications with a UI and status menu (menu extra/accessory menu/etc. – the name changes…).

    An accessory will not appear in the dock, have a standard menu bar, or appear in the Finder’s Force Quit dialog. It can be “active” and can have the key window.

    Though it does not have a standard menu bar bizarrely (maybe a bug) if a MainMenu is declared in the XIB then it will respond to key shortcuts when it is active. To avoid this make sure you have no MainMenu or use [NSApp setMainMenu:nil] when you wish to disable the shortcuts.

    The whole background/accessory/application/active/etc. area is not exactly well-defined, be prepared for “fun”…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a beer recipe application in Cocoa. It's has one main window,
I'm looking at building a Cocoa application on the Mac with a back-end daemon
I am building an application in Cocoa that uses a local Ruby on Rails
Background: I'm building a view-based NSTableView-esque control in Cocoa/Objective-C that offers the ease of
I'm just building my Cocoa app for distribution on mac app store, but this
I am building a mac application in cocoa and would like to know what
I'm building an Cocoa application that modifies a file on the user's operating system
I am building a dynamic form in a Cocoa application and am planning to
Building a website that has English & Japanese speaking users, with the Japanese users
I've got a client<=>server app I'm building for Mac OS X, using Objective-c/Cocoa and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.