diff --git kioexec/main.cpp kioexec/main.cpp index 06cd8f3..699e94f 100644 --- kioexec/main.cpp +++ kioexec/main.cpp @@ -21,6 +21,17 @@ #include "main.h" +#ifdef Q_OS_MAC +// kioexec is declared NOGUI in its CMakeLists.txt file, which on OS X means +// it is *not* created as an AppBundle (which we don't want). It can however +// also mean the KApplication instance will be created with GUIenabled=false +// (depending on the patches installed), which is not appropriate for kioexec. +// Undefining KDE_WITHOUT_GUI restores the pre 4.14.1 default behaviour (GUIenabled=true) +// (when included before kapplication.h ...) +#undef KDE_WITHOUT_GUI +#include +#endif + #include #include @@ -250,6 +261,21 @@ void KIOExec::slotRunApp() int main( int argc, char **argv ) { +#ifdef Q_OS_MAC + 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. + } + } +#endif + KAboutData aboutData( "kioexec", "kioexec", ki18n("KIOExec"), KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL, ki18n("(c) 1998-2000,2003 The KFM/Konqueror Developers"));