From 94f8c5b2c7cb43f6467849d037ea5d5a1deda2b9 Mon Sep 17 00:00:00 2001 From: ArcticLampyrid Date: Wed, 9 Oct 2024 16:40:58 +0800 Subject: [PATCH] fix: double icons in the dock bar on macOS (#65) (#79) --- src/Tray/main.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Tray/main.cc b/src/Tray/main.cc index eca6f5e4..de8c88e8 100644 --- a/src/Tray/main.cc +++ b/src/Tray/main.cc @@ -16,6 +16,12 @@ void exitApp() { int main(int argc, char* argv[]) { #ifdef __APPLE__ + // Prevent Qt being too clever + // See also https://github.com/qt/qtbase/blob/6.5.0/src/plugins/platforms/cocoa/qcocoaintegration.mm#L133-L139 + qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "1"); + + // Transform the process into a UI element application, + // which doesn't have a Dock icon or menu bar. ProcessSerialNumber psn = {0, kCurrentProcess}; TransformProcessType(&psn, kProcessTransformToUIElementApplication); #endif