From e2ecf588f66fb5dc9e31a3589695410d681d76d2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 24 Nov 2021 11:18:59 +0000 Subject: [PATCH] [startkde] Move ksplash loading to handle new kwin_wayland KSplash is changed to read which theme to use directly. It's already linking config and it already loads the default shared config implicitly so we weren't saving anything having it done by the launcher. On X11 ksplash is still managed by startplasma-x11 as we can do it straight away. For wayland we need to wait till kwin is up so this is done either by plasma-session or systemd. For systemd the unit is started explicitly so we can parse the config file, but after the target starting kwin is started so that the "After=" line works correctly. --- ksplash/ksplashqml/CMakeLists.txt | 1 + ksplash/ksplashqml/plasma-ksplash.service.in | 10 ++++++++++ ksplash/ksplashqml/splashapp.cpp | 10 ++++++++++ startkde/plasma-session/startup.cpp | 2 +- startkde/startplasma.cpp | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 ksplash/ksplashqml/plasma-ksplash.service.in diff --git a/ksplash/ksplashqml/CMakeLists.txt b/ksplash/ksplashqml/CMakeLists.txt index dc6b35ba6..624ecac82 100644 --- a/ksplash/ksplashqml/CMakeLists.txt +++ b/ksplash/ksplashqml/CMakeLists.txt @@ -23,3 +23,4 @@ target_link_libraries(ksplashqml install(TARGETS ksplashqml ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES org.kde.KSplash.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) +ecm_install_configured_files(INPUT plasma-ksplash.service.in @ONLY DESTINATION ${SYSTEMD_USER_UNIT_INSTALL_DIR}) diff --git a/ksplash/ksplashqml/plasma-ksplash.service.in b/ksplash/ksplashqml/plasma-ksplash.service.in new file mode 100644 index 000000000..95bea6c19 --- /dev/null +++ b/ksplash/ksplashqml/plasma-ksplash.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=Splash screen shown during boot +PartOf=graphical-session.target +After=plasma-kwin_wayland.service + +[Service] +ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/ksplashqml +Type=oneshot +Slice=background.slice +TimeoutSec=40sec diff --git a/ksplash/ksplashqml/splashapp.cpp b/ksplash/ksplashqml/splashapp.cpp index 48ab32e7e..3933efcc3 100644 --- a/ksplash/ksplashqml/splashapp.cpp +++ b/ksplash/ksplashqml/splashapp.cpp @@ -18,6 +18,10 @@ #include #include + +#include +#include + #include #define TEST_STEP_INTERVAL 2000 @@ -53,6 +57,12 @@ SplashApp::SplashApp(int &argc, char **argv) m_testing = parser.isSet(QStringLiteral("test")); m_window = parser.isSet(QStringLiteral("window")); m_theme = parser.positionalArguments().value(0); + if (m_theme.isEmpty()) { + KConfigGroup ksplashCfg = KSharedConfig::openConfig()->group("KSplash"); + if (ksplashCfg.readEntry("Engine", QStringLiteral("KSplashQML")) == QLatin1String("KSplashQML")) { + m_theme = ksplashCfg.readEntry("Theme", QStringLiteral("Breeze")); + } + } QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.registerObject(QStringLiteral("/KSplash"), this, QDBusConnection::ExportScriptableSlots); diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp index 8ca22f13a..d64c7bdec 100644 --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -174,7 +174,7 @@ Startup::Startup(QObject *parent) // the splashscreen and progress indicator KConfigGroup ksplashCfg = cfg.group("KSplash"); if (ksplashCfg.readEntry("Engine", QStringLiteral("KSplashQML")) == QLatin1String("KSplashQML")) { - QProcess::startDetached(QStringLiteral("ksplashqml"), {ksplashCfg.readEntry("Theme", QStringLiteral("Breeze"))}); + QProcess::startDetached(QStringLiteral("ksplashqml"), {}); } // FIXME 1: this code path is missing setupFontDpi() after X has started. Move to kcminit? // FIXME 2: the systemd path has no concept of kslpash diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index c622e024e..afab505ba 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -540,6 +540,21 @@ bool useSystemdBoot() return hasSystemdService(QStringLiteral("xdg-desktop-autostart.target")); } +void startKSplashViaSystemd() +{ + const KConfig cfg(QStringLiteral("ksplashrc")); + // the splashscreen and progress indicator + KConfigGroup ksplashCfg = cfg.group("KSplash"); + if (ksplashCfg.readEntry("Engine", QStringLiteral("KSplashQML")) == QLatin1String("KSplashQML")) { + auto msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"), + QStringLiteral("/org/freedesktop/systemd1"), + QStringLiteral("org.freedesktop.systemd1.Manager"), + QStringLiteral("StartUnit")); + msg << QStringLiteral("plasma-ksplash.service") << QStringLiteral("fail"); + QDBusReply reply = QDBusConnection::sessionBus().call(msg); + } +} + bool startPlasmaSession(bool wayland) { resetSystemdFailedUnits(); @@ -628,6 +643,9 @@ bool startPlasmaSession(bool wayland) } else { playStartupSound(&e); } + if (wayland) { + startKSplashViaSystemd(); + } } if (rc) { QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, &e, &QEventLoop::quit);