diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index d3fce09cad..595bda70ec 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -3,12 +3,15 @@ This file is part of the KDE project. SPDX-FileCopyrightText: 2010 Martin Gräßlin + SPDX-FileCopyrightText: 2020 David Redondo SPDX-License-Identifier: GPL-2.0-or-later */ #include "startupfeedback.h" // Qt #include +#include +#include #include #include #include @@ -70,6 +73,7 @@ StartupFeedbackEffect::StartupFeedbackEffect() , m_blinkingShader(nullptr) , m_cursorSize(24) , m_configWatcher(KConfigWatcher::create(KSharedConfig::openConfig("klaunchrc", KConfig::NoGlobals))) + , m_splashVisible(false) { for (int i = 0; i < 5; ++i) { m_bouncingTextures[i] = nullptr; @@ -87,6 +91,16 @@ StartupFeedbackEffect::StartupFeedbackEffect() }); reconfigure(ReconfigureAll); + m_splashVisible = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.KSplash")); + auto serviceWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.KSplash"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); + connect(serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this] { + m_splashVisible = true; + stop(); + }); + connect(serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this] { + m_splashVisible = false; + gotRemoveStartup(KStartupInfoId(), KStartupInfoData()); // Start the next feedback + }); } StartupFeedbackEffect::~StartupFeedbackEffect() @@ -258,7 +272,7 @@ void StartupFeedbackEffect::gotStartupChange(const KStartupInfoId& id, const KSt void StartupFeedbackEffect::start(const QString& icon) { - if (m_type == NoFeedback) + if (m_type == NoFeedback || m_splashVisible) return; if (!m_active) effects->startMousePolling(); diff --git a/effects/startupfeedback/startupfeedback.h b/effects/startupfeedback/startupfeedback.h index 81070eb9da..215e882bcd 100644 --- a/effects/startupfeedback/startupfeedback.h +++ b/effects/startupfeedback/startupfeedback.h @@ -78,6 +78,7 @@ private: GLShader *m_blinkingShader; int m_cursorSize; KConfigWatcher::Ptr m_configWatcher; + bool m_splashVisible; }; } // namespace