diff --git a/src/apps/deskflow-gui/MainWindow.cpp b/src/apps/deskflow-gui/MainWindow.cpp index 6f5dd19de..b2db9cbf0 100644 --- a/src/apps/deskflow-gui/MainWindow.cpp +++ b/src/apps/deskflow-gui/MainWindow.cpp @@ -36,9 +36,6 @@ #include "gui/tls/TlsFingerprint.h" #include "platform/wayland.h" -#if defined(Q_OS_MAC) -#include "gui/OSXHelpers.h" -#endif #if defined(Q_OS_LINUX) #include "config.h" #endif diff --git a/src/apps/deskflow-gui/MainWindow.h b/src/apps/deskflow-gui/MainWindow.h index edba3fb23..c20d77513 100644 --- a/src/apps/deskflow-gui/MainWindow.h +++ b/src/apps/deskflow-gui/MainWindow.h @@ -39,6 +39,10 @@ #include "gui/core/WaylandWarnings.h" #include "gui/tls/TlsUtility.h" +#ifdef Q_OS_MAC +#include "gui/OSXHelpers.h" +#endif + class QAction; class QMenu; class QLineEdit; @@ -94,6 +98,13 @@ public: } void autoAddScreen(const QString name); +#ifdef Q_OS_MAC + void hide() + { + macOSNativeHide(); + } +#endif + signals: void shown(); diff --git a/src/lib/gui/OSXHelpers.h b/src/lib/gui/OSXHelpers.h index 3d319a040..b76671842 100644 --- a/src/lib/gui/OSXHelpers.h +++ b/src/lib/gui/OSXHelpers.h @@ -31,4 +31,5 @@ bool isOSXDevelopmentBuild(); bool showOSXNotification(const QString &title, const QString &body); bool isOSXInterfaceStyleDark(); void forceAppActive(); +void macOSNativeHide(); IconsTheme getOSXIconsTheme(); diff --git a/src/lib/gui/OSXHelpers.mm b/src/lib/gui/OSXHelpers.mm index 37701e489..71d2cf74b 100644 --- a/src/lib/gui/OSXHelpers.mm +++ b/src/lib/gui/OSXHelpers.mm @@ -112,6 +112,11 @@ void forceAppActive() [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } +void macOSNativeHide() +{ + [NSApp hide:nil]; +} + IconsTheme getOSXIconsTheme() { if (@available(macOS 11, *))