Warning, /frameworks/kio/src/kiod/kiod_agent.mm is written in an unsupported language. File is not indexed.
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2017 René J.V. Bertin 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #import <CoreFoundation/CoreFoundation.h> 0008 #import <AppKit/AppKit.h> 0009 0010 // Set the LaunchServices LSUIElement property programmatically in unbundled 0011 // ("nongui") executables, instead of in the app bundle's Info.plist file. 0012 // This function has to be called as early as possible in main(), and before 0013 // creating the QApplication instance. 0014 void makeAgentApplication() 0015 { 0016 CFBundleRef mainBundle = CFBundleGetMainBundle(); 0017 if (mainBundle) { 0018 // get the application's Info Dictionary. For app bundles this would live in the bundle's Info.plist, 0019 // for regular executables it is obtained in another way. 0020 CFMutableDictionaryRef infoDict = (CFMutableDictionaryRef) CFBundleGetInfoDictionary(mainBundle); 0021 if (infoDict) { 0022 // Add or set the "LSUIElement" key with/to value "1". This can simply be a CFString. 0023 CFDictionarySetValue(infoDict, CFSTR("LSUIElement"), CFSTR("1")); 0024 // That's it. We're now considered as an "agent" by the window server, and thus will have 0025 // neither menubar nor presence in the Dock or App Switcher. 0026 } 0027 } 0028 } 0029 0030 void setAgentActivationPolicy() 0031 { 0032 [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory]; 0033 }