From e497f478dc26a8e76452db6480c4f193e7fe6c1a Mon Sep 17 00:00:00 2001 From: Vladimir Mitnitsky <33536734+Mitnitsky@users.noreply.github.com> Date: Fri, 24 Apr 2026 04:33:54 +0300 Subject: [PATCH] fix(macos): make fullscreen capture overlay configurable (#4622) macOS showFullScreen() triggers a native fullscreen space transition animation when capturing. Replace with show() using FramelessWindowHint, WindowStaysOnTopHint, and Qt::Tool flags to avoid the animation. Add a 'useNativeFullscreen' config option (default: off) so users who prefer the native fullscreen behavior can re-enable it from Settings > General. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/config/generalconf.cpp | 29 +++++++++++++++++++++++++++ src/config/generalconf.h | 9 +++++++++ src/core/flameshot.cpp | 7 +++++-- src/utils/confighandler.cpp | 3 +++ src/utils/confighandler.h | 3 +++ src/widgets/capture/capturewidget.cpp | 4 ++++ 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/config/generalconf.cpp b/src/config/generalconf.cpp index 996a3d5e17..3597b6e520 100644 --- a/src/config/generalconf.cpp +++ b/src/config/generalconf.cpp @@ -57,6 +57,9 @@ GeneralConf::GeneralConf(QWidget* parent) #if !defined(Q_OS_MACOS) initCaptureActiveMonitor(); #endif +#if defined(Q_OS_MACOS) + initUseNativeFullscreen(); +#endif #if defined(Q_OS_LINUX) initUseX11LegacyScreenshot(); #endif @@ -127,6 +130,9 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath) #if !defined(Q_OS_MACOS) m_captureActiveMonitor->setChecked(config.captureActiveMonitor()); #endif +#if defined(Q_OS_MACOS) + m_useNativeFullscreen->setChecked(config.useNativeFullscreen()); +#endif #if defined(Q_OS_LINUX) m_useX11LegacyScreenshot->setChecked(config.useX11LegacyScreenshot()); #endif @@ -937,6 +943,29 @@ void GeneralConf::captureActiveMonitorChanged(bool checked) } #endif +#if defined(Q_OS_MACOS) +void GeneralConf::initUseNativeFullscreen() +{ + m_useNativeFullscreen = + new QCheckBox(tr("Use native fullscreen for capture overlay"), this); + m_useNativeFullscreen->setToolTip( + tr("Use macOS native fullscreen mode for the capture overlay. " + "When disabled (default), the overlay avoids the fullscreen " + "desktop animation.")); + m_scrollAreaLayout->addWidget(m_useNativeFullscreen); + + connect(m_useNativeFullscreen, + &QCheckBox::clicked, + this, + &GeneralConf::useNativeFullscreenChanged); +} + +void GeneralConf::useNativeFullscreenChanged(bool checked) +{ + ConfigHandler().setUseNativeFullscreen(checked); +} +#endif + #if defined(Q_OS_LINUX) void GeneralConf::initUseX11LegacyScreenshot() { diff --git a/src/config/generalconf.h b/src/config/generalconf.h index db4f85d5a7..9510cd2ea7 100644 --- a/src/config/generalconf.h +++ b/src/config/generalconf.h @@ -64,6 +64,9 @@ private slots: #if !defined(Q_OS_MACOS) void captureActiveMonitorChanged(bool checked); #endif +#if defined(Q_OS_MACOS) + void useNativeFullscreenChanged(bool checked); +#endif #if defined(Q_OS_LINUX) void useX11LegacyScreenshotChanged(bool checked); #endif @@ -108,6 +111,9 @@ private slots: #if !defined(Q_OS_MACOS) void initCaptureActiveMonitor(); #endif +#if defined(Q_OS_MACOS) + void initUseNativeFullscreen(); +#endif #if defined(Q_OS_LINUX) void initUseX11LegacyScreenshot(); #endif @@ -162,6 +168,9 @@ private slots: #if !defined(Q_OS_MACOS) QCheckBox* m_captureActiveMonitor; #endif +#if defined(Q_OS_MACOS) + QCheckBox* m_useNativeFullscreen; +#endif #if defined(Q_OS_LINUX) QCheckBox* m_useX11LegacyScreenshot; #endif diff --git a/src/core/flameshot.cpp b/src/core/flameshot.cpp index 3d0385fa4e..6f96bddb5a 100644 --- a/src/core/flameshot.cpp +++ b/src/core/flameshot.cpp @@ -162,8 +162,11 @@ CaptureWidget* Flameshot::gui(const CaptureRequest& req) #ifdef Q_OS_WIN m_captureWindow->show(); #elif defined(Q_OS_MACOS) - // In "Emulate fullscreen mode" - m_captureWindow->showFullScreen(); + if (ConfigHandler().useNativeFullscreen()) { + m_captureWindow->showFullScreen(); + } else { + m_captureWindow->show(); + } m_captureWindow->activateWindow(); m_captureWindow->raise(); #else diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 66fbb1bee0..370d18af02 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -94,6 +94,9 @@ static QMap> OPTION("copyPathAfterSave" ,Bool ( false )), OPTION("antialiasingPinZoom" ,Bool ( true )), OPTION("useJpgForClipboard" ,Bool ( false )), +#if defined(Q_OS_MACOS) + OPTION("useNativeFullscreen" ,Bool ( false )), +#endif OPTION("uploadWithoutConfirmation" ,Bool ( false )), OPTION("saveAfterCopy" ,Bool ( false )), OPTION("savePath" ,ExistingDir ( )), diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index f687bf7dde..adc5d1e05e 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -120,6 +120,9 @@ class ConfigHandler : public QObject CONFIG_GETTER_SETTER(saveAsFileExtension, setSaveAsFileExtension, QString) CONFIG_GETTER_SETTER(antialiasingPinZoom, setAntialiasingPinZoom, bool) CONFIG_GETTER_SETTER(useJpgForClipboard, setUseJpgForClipboard, bool) +#if defined(Q_OS_MACOS) + CONFIG_GETTER_SETTER(useNativeFullscreen, setUseNativeFullscreen, bool) +#endif CONFIG_GETTER_SETTER(uploadWithoutConfirmation, setUploadWithoutConfirmation, bool) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index e3db3d4558..25a887a8dc 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -164,6 +164,10 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req, windowHandle()->setScreen(selectedScreen); } #elif defined(Q_OS_MACOS) + if (!ConfigHandler().useNativeFullscreen()) { + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | + Qt::Tool); + } QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); move(currentScreen->geometry().x(), currentScreen->geometry().y()); resize(currentScreen->size());