From 9171f24afe6be37e1ac384b8ef03ff89b552be7a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 25 Jun 2025 17:25:37 +0300 Subject: [PATCH 1/2] startkde: Remove Before=plasma-ksplash-ready.service This line makes ksplash wait for unrelated services such as powerdevil and baloo. This change reduces plasma startup time on my machine to 2-3 seconds. --- startkde/systemd/plasma-workspace.target | 1 - 1 file changed, 1 deletion(-) diff --git a/startkde/systemd/plasma-workspace.target b/startkde/systemd/plasma-workspace.target index a62db5e252a..a9113f49112 100644 --- a/startkde/systemd/plasma-workspace.target +++ b/startkde/systemd/plasma-workspace.target @@ -17,7 +17,6 @@ Wants=xdg-desktop-autostart.target BindsTo=graphical-session.target Before=graphical-session.target Before=xdg-desktop-autostart.target -Before=plasma-ksplash-ready.service Before=plasma-restoresession.service RefuseManualStart=yes StopWhenUnneeded=true -- GitLab From 8202ba92b610c691b8bc6bab8ad5a1c3b9ac73da Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 25 Jun 2025 17:29:19 +0300 Subject: [PATCH 2/2] startkde: Drop ready stage In order to hide the splash screen, it is sufficient just to see the wallpaper. If more desktop environment components are loaded soon afterwards, it is okay. With systemd boot, the way the ready stage is integrated is also kind of a hack. --- appiumtests/CMakeLists.txt | 1 - appiumtests/ksplash/CMakeLists.txt | 14 ---- appiumtests/ksplash/ksplashtest.py | 79 ------------------- ksplash/ksplashqml/splashapp.cpp | 5 +- startkde/plasma-session/startup.cpp | 11 --- startkde/plasma-session/startup.h | 1 - startkde/systemd/CMakeLists.txt | 3 - .../systemd/plasma-ksplash-ready.service.in | 10 --- startkde/systemd/plasma-workspace.target | 1 - 9 files changed, 2 insertions(+), 123 deletions(-) delete mode 100644 appiumtests/ksplash/CMakeLists.txt delete mode 100755 appiumtests/ksplash/ksplashtest.py delete mode 100644 startkde/systemd/plasma-ksplash-ready.service.in diff --git a/appiumtests/CMakeLists.txt b/appiumtests/CMakeLists.txt index 68d0b6895ba..22234aeb031 100644 --- a/appiumtests/CMakeLists.txt +++ b/appiumtests/CMakeLists.txt @@ -20,5 +20,4 @@ add_subdirectory(applets) add_subdirectory(components_tests) add_subdirectory(kcms) add_subdirectory(krunner) -add_subdirectory(ksplash) add_subdirectory(wallpapers) diff --git a/appiumtests/ksplash/CMakeLists.txt b/appiumtests/ksplash/CMakeLists.txt deleted file mode 100644 index 3bea5174f5a..00000000000 --- a/appiumtests/ksplash/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Fushan Wen -# SPDX-License-Identifier: BSD-3-Clause - -add_test( - NAME ksplashtest_wayland - COMMAND sh -c "mkdir -p /tmp/appium/ksplashtest_wayland;dbus-launch selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/ksplashtest.py --failfast" -) -set_tests_properties(ksplashtest_wayland PROPERTIES TIMEOUT 60 ENVIRONMENT "XDG_RUNTIME_DIR=/tmp/appium/ksplashtest_wayland;FLASK_PORT=5701") - -add_test( - NAME ksplashtest_x11 - COMMAND sh -c "mkdir -p /tmp/appium/ksplashtest_x11;dbus-launch selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/ksplashtest.py --failfast" -) -set_tests_properties(ksplashtest_x11 PROPERTIES TIMEOUT 60 ENVIRONMENT "XDG_RUNTIME_DIR=/tmp/appium/ksplashtest_x11;FLASK_PORT=5702;TEST_WITH_KWIN_WAYLAND=0") diff --git a/appiumtests/ksplash/ksplashtest.py b/appiumtests/ksplash/ksplashtest.py deleted file mode 100755 index b7ca43c0519..00000000000 --- a/appiumtests/ksplash/ksplashtest.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: 2024 Fushan Wen -# SPDX-License-Identifier: MIT - -# pylint: disable=too-many-arguments - -import os -import subprocess -import sys -import time -import unittest - -from appium import webdriver -from appium.options.common.base import AppiumOptions -from appium.webdriver.common.appiumby import AppiumBy -from gi.repository import Gio, GLib - - -class KSplashTest(unittest.TestCase): - - driver: webdriver.Remote - - @classmethod - def setUpClass(cls) -> None: - options = AppiumOptions() - options.set_capability("app", "ksplashqml --window") - options.set_capability("environ", { - "LC_ALL": "en_US.UTF-8", - "QT_FATAL_WARNINGS": "1", - "QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;kf.plasma.core.warning=false;kf.windowsystem.warning=false;kf.kirigami.platform.warning=false;org.kde.plasma.ksplashqml.debug=true", - }) - options.set_capability("timeouts", {'implicit': 10000}) - cls.driver = webdriver.Remote(command_executor=f'http://127.0.0.1:{os.getenv("FLASK_PORT", "4723")}', options=options) - - def tearDown(self) -> None: - """ - Take screenshot when the current test fails - """ - if not self._outcome.result.wasSuccessful(): - self.driver.get_screenshot_as_file(f"failed_test_shot_ksplash_#{self.id()}.png") - - def test_1_bug494840_setStage(self) -> None: - """ - Checks if the setStage method is ever called after starting plasma-ksplash-ready.service. - """ - if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0": - stages = ("wm", "kcminit", "ksmserver", "startPlasma", "desktop") - else: - stages = ("kcminit", "ksmserver", "startPlasma", "desktop") - - session_bus = Gio.bus_get_sync(Gio.BusType.SESSION) - for stage in stages: - message: Gio.DBusMessage = Gio.DBusMessage.new_method_call("org.kde.KSplash", "/KSplash", "org.kde.KSplash", "setStage") - message.set_body(GLib.Variant("(s)", [stage])) - session_bus.send_message_with_reply_sync(message, Gio.DBusSendMessageFlags.NONE, 3000) - - self.driver.find_element(AppiumBy.NAME, "Plasma made by KDE") - - with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "startkde", "systemd", "plasma-ksplash-ready.service.in"), encoding="utf-8") as handler: - for line in handler: - if line.startswith("ExecStart="): - command = line.removeprefix("ExecStart=").strip().split(" ") - subprocess.check_call(command, stdout=sys.stderr, stderr=sys.stderr) - break - - success = False - for _ in range(10): - try: - subprocess.check_call(["pidof", "ksplashqml"]) - except subprocess.CalledProcessError: - success = True - break - time.sleep(1) - self.assertTrue(success) - - -if __name__ == '__main__': - unittest.main() diff --git a/ksplash/ksplashqml/splashapp.cpp b/ksplash/ksplashqml/splashapp.cpp index b60a58724be..2262503b1c3 100644 --- a/ksplash/ksplashqml/splashapp.cpp +++ b/ksplash/ksplashqml/splashapp.cpp @@ -26,13 +26,12 @@ #define TEST_STEP_INTERVAL 2000 /** - * There are 7 stages in ksplash + * There are 6 stages in ksplash * - initial (from this class) * - startPlasma (from startplasma) * - kcminit * - ksmserver * - wm (for X11 from KWin, for Wayland from this class) - * - ready (from plasma-session startup) * - desktop (from shellcorona) */ @@ -114,7 +113,7 @@ void SplashApp::setStage(const QString &stage) void SplashApp::setStage(int stage) { m_stage = stage; - if (m_stage == 7) { + if (m_stage == 6) { QGuiApplication::exit(EXIT_SUCCESS); } for (SplashWindow *w : std::as_const(m_windows)) { diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp index a731c7b2791..0567e00881f 100644 --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -206,20 +206,9 @@ Startup::Startup(QObject *parent) // app will be closed when all KJobs finish thanks to the QEventLoopLocker in each KJob } -void Startup::upAndRunning(const QString &msg) -{ - QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), - QStringLiteral("/KSplash"), - QStringLiteral("org.kde.KSplash"), - QStringLiteral("setStage")); - ksplashProgressMessage.setArguments(QList() << msg); - QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage); -} - void Startup::finishStartup() { qCDebug(PLASMA_SESSION) << "Finished"; - upAndRunning(QStringLiteral("ready")); playStartupSound(); new SessionTrack(m_processes); diff --git a/startkde/plasma-session/startup.h b/startkde/plasma-session/startup.h index 6ef4fee9bdd..876a1439fce 100644 --- a/startkde/plasma-session/startup.h +++ b/startkde/plasma-session/startup.h @@ -20,7 +20,6 @@ class Startup : public QObject Q_OBJECT public: Startup(QObject *parent); - void upAndRunning(const QString &msg); void finishStartup(); static Startup *self() diff --git a/startkde/systemd/CMakeLists.txt b/startkde/systemd/CMakeLists.txt index 2f5d30e8456..c3455ebae81 100644 --- a/startkde/systemd/CMakeLists.txt +++ b/startkde/systemd/CMakeLists.txt @@ -1,6 +1,3 @@ -ecm_install_configured_files(INPUT plasma-ksplash-ready.service.in @ONLY - DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR}) - install(FILES plasma-core.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR}) install(FILES plasma-workspace.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR}) install(FILES plasma-workspace-wayland.target DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR}) diff --git a/startkde/systemd/plasma-ksplash-ready.service.in b/startkde/systemd/plasma-ksplash-ready.service.in deleted file mode 100644 index 1e903130a96..00000000000 --- a/startkde/systemd/plasma-ksplash-ready.service.in +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=KSplash "ready" Stage -Wants=plasma-core.target -After=plasma-core.target -PartOf=graphical-session.target - -[Service] -Type=oneshot -ExecStart=dbus-send --session --reply-timeout=1 --type=method_call --dest=org.kde.KSplash /KSplash org.kde.KSplash.setStage string:ready -Slice=session.slice diff --git a/startkde/systemd/plasma-workspace.target b/startkde/systemd/plasma-workspace.target index a9113f49112..4cc8d9330c3 100644 --- a/startkde/systemd/plasma-workspace.target +++ b/startkde/systemd/plasma-workspace.target @@ -6,7 +6,6 @@ Wants=plasma-restoresession.service Wants=plasma-xembedsniproxy.service Wants=plasma-gmenudbusmenuproxy.service Wants=plasma-powerdevil.service -Wants=plasma-ksplash-ready.service Wants=plasma-polkit-agent.service Wants=kde-baloo.service Wants=plasma-foreground-booster.service -- GitLab