Hi,

There are 2 ways in which an OS X application can be turned into an agent, i.e. 
an application that has no presence in the Dock and doesn't show up in the App 
Switcher:

1. Set LSUIElement to true in the app bundle's Info.plist
2. Do the same thing programmatically :

    CFBundleRef mainBundle = CFBundleGetMainBundle();
    if (mainBundle) {
        // get the application's Info Dictionary. For app bundles this would 
live in the bundle's Info.plist,
        // for regular executables it is obtained in another way.
        CFMutableDictionaryRef infoDict = (CFMutableDictionaryRef) 
CFBundleGetInfoDictionary(mainBundle);
        if (infoDict) {
            // Add or set the "LSUIElement" key with/to value "1". This can 
simply be a CFString.
            CFDictionarySetValue(infoDict, CFSTR("LSUIElement"), CFSTR("1"));
            // That's it. We're now considered as an "agent" by the window 
server, and thus will have
            // neither menubar nor presence in the Dock or App Switcher.
        }
    }

Typical "agent" applications are those that only provide an icon and menu in 
the "systray" (icons on the RHS of the global menubar), but any background 
application that needs to be able to post dialogs or even receive GUI events 
(think read keystrokes) will need to be such an agent.

The QPA cocoa platform does have a function which does more or less the 
opposite (qt_mac_transformProccessToForegroundApplication, sic!) but I don't 
see to create an agent. Is there? If not, would it make sense in e.g. the 
MacExtras component?

R.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to