Can I make modal windows appear frontmost? I want to see alerts and modals from applications in the background.

I am new in the Mac world. I have a small utility for the Mac that shows a modal window after some time. Basically, it prints some very useful information for me.

I am expecting that this modal window will appear while I am working on different things (surfing on internet, reading emails), but instead of seeing the modal window the application annoyingly bounces it's icon in Dock; obvioulsy which means that my software needs my attention.

The same thing happens with iTunes, communicators, Safari, etc.

  • As this is a software development question, you should ask over on StackExchange. This site is for Apple customers rather than developers. As you wait for more detailed answers over on StackExchange, that look at NSUserNotification. Nov 8 '15 at 15:23
  • @GrahamMiln I have no access to iTunes or Safari source code to control it's behaviour. This is more general problem about presenting modal views in osx. Nov 8 '15 at 18:01
  • Please could you re-word your question. Are you asking about Safari and other applications behaviour – or is your question about your own application? For your own application, use NSUserNotification. Nov 8 '15 at 18:16
  • @GrahamMiln It's general. I just want to make all apps immediately notify me when they need my attention (not through bouncing icon). Question is not related to software development. Nov 9 '15 at 17:56
  • I have rephrased your question and nominated it for reopening. Nov 9 '15 at 18:11

Modal dialogs aren't something you can guarantee will show. The OS allows users to use multiple displays, multiple virtual desktops, pin apps to all displays, no displays or a specific display.

Notification center is the correct tool to send a notice to a user so I would redesign your script/tool/app to make use of notification center.

Also, without seeing some bare stub of what you have already, it's really hard to suggest you how to implement a change. Just as on Stack Overflow - if you have a problem with a tool or a script here, please show your work and ask a follow on question to explain exactly what you desire to happen and what you have so far.

Here's a tiny python script you could try: a little python "script" I've adapted from a brief search of SO:

import Foundation
import objc
import AppKit
import sys

note = objc.lookUpClass('NSUserNotification')
center = objc.lookUpClass('NSUserNotificationCenter')

def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}):
    notification = note.alloc().init()
    if sound:
    notification.setDeliveryDate_(Foundation.NSDate.dateWithTimeInterval_sinceDate_(delay, Foundation.NSDate.date()))

notify("AskDifferent", "you can program now", "Here we go... ", sound=True)
sys.stdout.write("Notification sent...\n")

It works on El Capitan without needing any extra files or downloads afaik. Again, there are dozens of options and languages, so it's more about what you want to do long term and if you're comfortable with modifying scripts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .