diff options
-rw-r--r-- | synchronizer/CMakeLists.txt | 3 | ||||
-rw-r--r-- | synchronizer/main.cpp | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/synchronizer/CMakeLists.txt b/synchronizer/CMakeLists.txt index 9c422e6..3ea5521 100644 --- a/synchronizer/CMakeLists.txt +++ b/synchronizer/CMakeLists.txt | |||
@@ -15,4 +15,7 @@ target_link_libraries(${PROJECT_NAME} | |||
15 | KAsync | 15 | KAsync |
16 | ${CMAKE_DL_LIBS} | 16 | ${CMAKE_DL_LIBS} |
17 | ) | 17 | ) |
18 | if(APPLE) | ||
19 | target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation") | ||
20 | endif() | ||
18 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | 21 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) |
diff --git a/synchronizer/main.cpp b/synchronizer/main.cpp index 479a0bf..1a79622 100644 --- a/synchronizer/main.cpp +++ b/synchronizer/main.cpp | |||
@@ -38,6 +38,9 @@ | |||
38 | #include "log.h" | 38 | #include "log.h" |
39 | #include "test.h" | 39 | #include "test.h" |
40 | #include "definitions.h" | 40 | #include "definitions.h" |
41 | #ifdef Q_OS_OSX | ||
42 | #include <CoreFoundation/CoreFoundation.h> | ||
43 | #endif | ||
41 | 44 | ||
42 | static Listener *listener = nullptr; | 45 | static Listener *listener = nullptr; |
43 | 46 | ||
@@ -226,6 +229,20 @@ int main(int argc, char *argv[]) | |||
226 | 229 | ||
227 | qInstallMessageHandler(qtMessageHandler); | 230 | qInstallMessageHandler(qtMessageHandler); |
228 | 231 | ||
232 | #ifdef Q_OS_OSX | ||
233 | if (CFBundleRef mainBundle = CFBundleGetMainBundle()) { | ||
234 | // get the application's Info Dictionary. For app bundles this would live in the bundle's Info.plist, | ||
235 | // for regular executables it is obtained in another way. | ||
236 | CFMutableDictionaryRef infoDict = (CFMutableDictionaryRef) CFBundleGetInfoDictionary(mainBundle); | ||
237 | if (infoDict) { | ||
238 | // Add or set the "LSUIElement" key with/to value "1". This can simply be a CFString. | ||
239 | CFDictionarySetValue(infoDict, CFSTR("LSUIElement"), CFSTR("1")); | ||
240 | // That's it. We're now considered as an "agent" by the window server, and thus will have | ||
241 | // neither menubar nor presence in the Dock or App Switcher. | ||
242 | } | ||
243 | } | ||
244 | #endif | ||
245 | |||
229 | //Necessary to hide this QGuiApplication from the dock and application switcher on mac os. | 246 | //Necessary to hide this QGuiApplication from the dock and application switcher on mac os. |
230 | qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true"); | 247 | qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true"); |
231 | QGuiApplication::setAttribute(Qt::AA_PluginApplication); | 248 | QGuiApplication::setAttribute(Qt::AA_PluginApplication); |