diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-04 18:13:08 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-04 18:13:08 +0200 |
commit | 97488acf72ed8ab0832e37bd33b7a02d0e9d4fef (patch) | |
tree | 5ea848dc8d4c8a269e87d2d690494931cfd59416 /synchronizer/main.cpp | |
parent | 322c29231f09c675a5ea2fac8346c1206bb4d5da (diff) | |
download | sink-97488acf72ed8ab0832e37bd33b7a02d0e9d4fef.tar.gz sink-97488acf72ed8ab0832e37bd33b7a02d0e9d4fef.zip |
Try again to disable the dock
Diffstat (limited to 'synchronizer/main.cpp')
-rw-r--r-- | synchronizer/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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); |