From 1641ea3897d565d672e29a7524ce4171ddbcfd32 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 25 Jun 2025 14:00:05 +0300 Subject: [PATCH 1/2] shell: Set desktop ksplash stage when all desktop views are ready If there are two outputs and the wallpaper for the first one is ready but for the second one is not, the ksplash will be notified about the desktop stage. This changes fixes checkAllDesktopsUiReady() so it sets the desktop stage only if all desktop views are ready. --- shell/shellcorona.cpp | 28 +++++++++++++++------------- shell/shellcorona.h | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 37d93d05353..65c8ccc272e 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -1338,6 +1338,8 @@ void ShellCorona::removeDesktop(DesktopView *desktopView) desktopView->destroy(); desktopView->containment()->reactToScreenChange(); + + checkAllDesktopsUiReady(); } PanelView *ShellCorona::panelView(Plasma::Containment *containment) const @@ -1529,22 +1531,22 @@ void ShellCorona::addOutput(QScreen *screen) #endif } -void ShellCorona::checkAllDesktopsUiReady(bool ready) +void ShellCorona::checkAllDesktopsUiReady() { - if (!ready) + const bool ready = std::ranges::all_of(std::as_const(m_desktopViewForScreen), [](const DesktopView *view) { + return view->containment()->isUiReady(); + }); + if (!ready) { return; - for (auto v : std::as_const(m_desktopViewForScreen)) { - if (!v->containment()->isUiReady()) - return; - - qCDebug(PLASMASHELL) << "Plasma Shell startup completed"; - QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), - QStringLiteral("/KSplash"), - QStringLiteral("org.kde.KSplash"), - QStringLiteral("setStage")); - ksplashProgressMessage.setArguments(QList() << QStringLiteral("desktop")); - QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage); } + + qCDebug(PLASMASHELL) << "Plasma Shell startup completed"; + QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), + QStringLiteral("/KSplash"), + QStringLiteral("org.kde.KSplash"), + QStringLiteral("setStage")); + ksplashProgressMessage.setArguments(QList() << QStringLiteral("desktop")); + QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage); } Plasma::Containment *ShellCorona::createContainmentForActivity(const QString &activity, int screenNum) diff --git a/shell/shellcorona.h b/shell/shellcorona.h index 0f544ca266f..7b6c6a559a1 100644 --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -275,7 +275,7 @@ private: DesktopView *desktopForScreen(QScreen *screen) const; void setupWaylandIntegration(); void executeSetupPlasmoidScript(Plasma::Containment *containment, Plasma::Applet *applet); - void checkAllDesktopsUiReady(bool ready); + void checkAllDesktopsUiReady(); void activateLauncherMenu(const QString &screenName); void handleColorRequestedFromDBus(const QDBusMessage &msg); -- GitLab From 00bd19ecaccbb10d5cfcc6006b06a9714c615741 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 25 Jun 2025 14:03:28 +0300 Subject: [PATCH 2/2] shell: Create panel views after desktop views are ready With the current code, the splash screen will be hidden as soon as the wallpapers are loaded. However, the splash screnn is actually notified about the desktop stage about 1-1.5 second later after the wallpaper plugin resets the loading property. The reason for that is that the panel is loaded between `wallpaper.loading = false` in the wallpaper and ShellCorona::checkAllDesktopsUiReady(). This change re-arranges the startup sequence so the panels are loaded after the desktop views become ready. It reduces plasma startup time a bit. In long term, we should look for making panel loading as async as possible so the main thread doesn't get blocked for too long. --- shell/shellcorona.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 65c8ccc272e..6a59683dba7 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -868,10 +868,6 @@ void ShellCorona::load() connect(m_screenPool, &ScreenPool::screenOrderChanged, this, &ShellCorona::handleScreenOrderChanged, Qt::UniqueConnection); connect(m_screenPool, &ScreenPool::screenRemoved, this, &ShellCorona::handleScreenRemoved, Qt::UniqueConnection); - if (!m_waitingPanels.isEmpty()) { - m_waitingPanelsTimer.start(); - } - if (config()->isImmutable() || !KAuthorized::authorize(QStringLiteral("plasma/plasmashell/unlockedDesktop"))) { setImmutability(Plasma::Types::SystemImmutable); } else { @@ -1517,11 +1513,6 @@ void ShellCorona::addOutput(QScreen *screen) // in the list. We still don't want to have an invisible view added. containment->reactToScreenChange(); - // were there any panels for this screen before it popped up? - if (!m_waitingPanels.isEmpty()) { - m_waitingPanelsTimer.start(); - } - if (!m_screenReorderInProgress) { Q_EMIT availableScreenRectChanged(m_screenPool->idForScreen(screen)); } @@ -1547,6 +1538,10 @@ void ShellCorona::checkAllDesktopsUiReady() QStringLiteral("setStage")); ksplashProgressMessage.setArguments(QList() << QStringLiteral("desktop")); QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage); + + if (!m_waitingPanels.isEmpty()) { + m_waitingPanelsTimer.start(); + } } Plasma::Containment *ShellCorona::createContainmentForActivity(const QString &activity, int screenNum) @@ -1604,7 +1599,7 @@ void ShellCorona::createWaitingPanels() QScreen *screen = m_screenPool->screenForId(requestedScreen); DesktopView *desktopView = desktopForScreen(screen); - if (!screen || !desktopView) { + if (!screen || !desktopView || !desktopView->containment()->isUiReady()) { stillWaitingPanels << cont; continue; } -- GitLab