I don't know if this problem is specific to Quicksilver or a general problem with modal windows. I use QS to launch an applescript:

"run 'command' with administrator privileges"

But the modal window from QS to enter my password appears without focus. I can't I need to click on the window with the mouse in order to be able to activate it. I would guess that this is because QS has launched the applescript "in the background" as it were, and already returned focus to the previous app.

Is there a way to switch to this modal window using keyboard actions? It's something I need to do every morning and it's very annoying to have to switch over to it with the mouse every time. I can't command-tab to Quicksilver when the dialog is active.

2 Answers 2


You can focus SecurityAgent:

osascript -e 'do shell script "ls /var/root" with administrator privileges' &
open -a SecurityAgent

Displaying dialogs:

tell application (path to frontmost application as text)
    display dialog "" default answer ""
end tell

⌃F6 (Move focus to the floating window) doesn't work with the password dialogs, and Witch doesn't include them either. You might use a script like this though:

tell application "System Events"
    repeat with p in {"SecurityAgent", "CoreServicesUIAgent", "loginwindow"}
        if exists process p then
            tell process p
                if windows is not {} then
                    set frontmost to true
                    exit repeat
                end if
            end tell
        end if
    end repeat
end tell

CoreServicesUIAgent displays Gatekeeper and quarantine dialogs. loginwindow displays many of the dialogs shown when logging out.

  • Thanks for the info. I couldn't get the examples above to work in my script, but they pointed me in the right direction. Jun 24, 2013 at 18:21

The solution was obvious once I saw it: first make Quicksilver the foreground app, then it won't return focus to another app when the script runs.

tell application "Quicksilver" to activate
do shell script "pmset -c displaysleep 180" with administrator privileges

You must log in to answer this question.

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