diff --git a/launchercontroller.cpp b/launchercontroller.cpp index d839b780..c36f5e87 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -115,6 +115,11 @@ void LauncherController::setVisible(bool visible) emit visibleChanged(m_visible); } +bool LauncherController::isFullScreenFrame() const +{ + return m_currentFrame == QStringLiteral("FullscreenFrame"); +} + QString LauncherController::currentFrame() const { return m_currentFrame; diff --git a/launchercontroller.h b/launchercontroller.h index f8e6cda3..ab2ed26e 100644 --- a/launchercontroller.h +++ b/launchercontroller.h @@ -42,6 +42,7 @@ class LauncherController : public QObject bool visible() const; void setVisible(bool visible); + bool isFullScreenFrame() const; QString currentFrame() const; void setCurrentFrame(const QString & frame); diff --git a/src/ddeintegration/appearance.cpp b/src/ddeintegration/appearance.cpp index bb6b37bc..8f852866 100644 --- a/src/ddeintegration/appearance.cpp +++ b/src/ddeintegration/appearance.cpp @@ -26,10 +26,10 @@ Appearance::Appearance(QObject *parent) if (key == "allwallpaperuris") updateAllWallpaper(); }); - connect(&(LauncherController::instance()), &LauncherController::visibleChanged, this, [this](bool isVisible){ - if (isVisible && (QStringLiteral("FullscreenFrame") == LauncherController::instance().currentFrame())) - updateCurrentWallpaperBlurhash(); - }); + connect(&(LauncherController::instance()), &LauncherController::currentFrameChanged, + this, &Appearance::updateCurrentWallpaperBlurhash); + connect(&(LauncherController::instance()), &LauncherController::visibleChanged, + this, &Appearance::updateCurrentWallpaperBlurhash); if (m_dbusAppearanceIface->isValid()) { connect(m_dbusAppearanceIface, &Appearance1::OpacityChanged, this, [this](double value) { @@ -51,6 +51,9 @@ QString Appearance::wallpaperBlurhash() const void Appearance::updateCurrentWallpaperBlurhash() { + if (!LauncherController::instance().visible() || !LauncherController::instance().isFullScreenFrame()) + return; + const QString screenName = qApp->primaryScreen()->name(); QDBusPendingReply async = m_dbusAppearanceIface->GetCurrentWorkspaceBackgroundForMonitor(screenName); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this);