Index: src/kioslave/CMakeLists.txt =================================================================== --- src/kioslave/CMakeLists.txt +++ src/kioslave/CMakeLists.txt @@ -1,8 +1,17 @@ add_executable(kioslave kioslave.cpp) -ecm_mark_nongui_executable(kioslave) target_link_libraries(kioslave KF5::KIOCore ) +if (APPLE) + target_link_libraries(kioslave "-framework CoreFoundation") +endif () + install(TARGETS kioslave DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5} ) +if(APPLE) + # create a wrapper for the kioslave bundle-exec so it can be found via + # the regular, expected path. + configure_file(kioslave_wrapper.in ${CMAKE_CURRENT_BINARY_DIR}/kioslave @ONLY) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kioslave DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5} ) +endif(APPLE) Index: src/kioslave/kioslave.cpp =================================================================== --- src/kioslave/kioslave.cpp +++ src/kioslave/kioslave.cpp @@ -46,6 +46,10 @@ #endif #endif +#ifdef Q_OS_MACOS +#include +#endif + #ifndef Q_OS_WIN /* These are to link libkio even if 'smart' linker is used */ #include @@ -57,6 +61,20 @@ int main(int argc, char **argv) { +#ifdef Q_OS_MACOS + 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 if (argc < 5) { fprintf(stderr, "Usage: kioslave \n\nThis program is part of KDE.\n"); return 1; Index: src/kioslave/kioslave_wrapper.in =================================================================== --- /dev/null +++ src/kioslave/kioslave_wrapper.in @@ -0,0 +1,3 @@ +#!/bin/sh + +exec "@KDE_INSTALL_LIBEXECDIR_KF5@/kioslave.app/Contents/MacOS/kioslave" "$@"