diff --git a/ksmserver/plasma-ksmserver.service.in b/ksmserver/plasma-ksmserver.service.in index 427be409b..4d45d6a8e 100644 --- a/ksmserver/plasma-ksmserver.service.in +++ b/ksmserver/plasma-ksmserver.service.in @@ -1,7 +1,7 @@ [Unit] Description=KDE Session Management Server -Wants=plasma-kcminit.service PartOf=graphical-session.target +After=plasma-kwin_wayland.service plasma-kcminit.service [Service] ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/ksmserver diff --git a/startkde/CMakeLists.txt b/startkde/CMakeLists.txt index 0ad24c8b7..406aedbd3 100644 --- a/startkde/CMakeLists.txt +++ b/startkde/CMakeLists.txt @@ -30,7 +30,6 @@ target_link_libraries(startplasma PUBLIC add_executable(startplasma-x11 ${START_PLASMA_COMMON_SRCS} startplasma-x11.cpp kcheckrunning/kcheckrunning.cpp) add_executable(startplasma-wayland ${START_PLASMA_COMMON_SRCS} startplasma-wayland.cpp) -add_executable(startplasma-waylandsession ${START_PLASMA_COMMON_SRCS} startplasma-waylandsession.cpp) target_link_libraries(startplasma-x11 PRIVATE startplasma @@ -41,9 +40,6 @@ target_link_libraries(startplasma-wayland PRIVATE startplasma ) -target_link_libraries(startplasma-waylandsession PRIVATE - startplasma -) add_subdirectory(plasma-session) add_subdirectory(plasma-shutdown) @@ -57,6 +53,5 @@ configure_file(config-startplasma.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-sta install(TARGETS startplasma-x11 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS startplasma-wayland ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -install(TARGETS startplasma-waylandsession DESTINATION ${KDE_INSTALL_LIBEXECDIR}) install(PROGRAMS plasma-sourceenv.sh DESTINATION ${KDE_INSTALL_LIBEXECDIR}) install(PROGRAMS plasma-dbus-run-session-if-needed DESTINATION ${KDE_INSTALL_LIBEXECDIR}) diff --git a/startkde/kcminit/plasma-kcminit.service.in b/startkde/kcminit/plasma-kcminit.service.in index 45d2e0d78..198f81fbd 100644 --- a/startkde/kcminit/plasma-kcminit.service.in +++ b/startkde/kcminit/plasma-kcminit.service.in @@ -1,6 +1,7 @@ [Unit] Description=KDE Config Module Initialization PartOf=graphical-session.target +After=plasma-kwin_wayland.service [Service] ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/kcminit_startup diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp index 50ea86741..8ca22f13a 100644 --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -148,10 +148,7 @@ Startup::Startup(QObject *parent) const AutoStart autostart; - // Keep for KF5; remove in KF6 (KInit will be gone then) - QProcess::execute(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit_wrapper"), QStringList()); - - KJob *windowManagerJob = nullptr; + KJob *x11WindowManagerJob = nullptr; if (qEnvironmentVariable("XDG_SESSION_TYPE") != QLatin1String("wayland")) { QString windowManager; if (qEnvironmentVariableIsSet("KDEWM")) { @@ -162,19 +159,38 @@ Startup::Startup(QObject *parent) } if (windowManager == QLatin1String(KWIN_BIN)) { - windowManagerJob = new StartServiceJob(windowManager, {}, QStringLiteral("org.kde.KWin")); + x11WindowManagerJob = new StartServiceJob(windowManager, {}, QStringLiteral("org.kde.KWin")); } else { - windowManagerJob = new StartServiceJob(windowManager, {}, {}); + x11WindowManagerJob = new StartServiceJob(windowManager, {}, {}); + } + } else { + // This must block until started as it sets the WAYLAND_DISPLAY/DISPLAY env variables needed for the rest of the boot + // fortunately it's very fast as it's just starting a wrapper + StartServiceJob kwinWaylandJob(QStringLiteral("kwin_wayland_wrapper"), {QStringLiteral("--xwayland")}, QStringLiteral("org.kde.KWinWrapper")); + kwinWaylandJob.exec(); + // kslpash is only launched in plasma-session from the wayland mode, for X it's in startplasma-x11 + + const KConfig cfg(QStringLiteral("ksplashrc")); + // 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"))}); } + // 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 + // FIXME 3: the systemd code path is missing setupFontDpi } + // Keep for KF5; remove in KF6 (KInit will be gone then) + QProcess::execute(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit_wrapper"), QStringList()); + KJob *phase1 = nullptr; m_lock.reset(new QEventLoopLocker); const QVector sequence = { new StartProcessJob(QStringLiteral("kcminit_startup"), {}), new StartServiceJob(QStringLiteral("kded5"), {}, QStringLiteral("org.kde.kded5"), {}), - windowManagerJob, + x11WindowManagerJob, new StartServiceJob(QStringLiteral("ksmserver"), QCoreApplication::instance()->arguments().mid(1), QStringLiteral("org.kde.ksmserver")), new StartupPhase0(autostart, this), phase1 = new StartupPhase1(autostart, this), diff --git a/startkde/startplasma-wayland.cpp b/startkde/startplasma-wayland.cpp index e09b290d2..9fe023843 100644 --- a/startkde/startplasma-wayland.cpp +++ b/startkde/startplasma-wayland.cpp @@ -82,16 +82,16 @@ int main(int argc, char **argv) // variables (e.g. LANG and LC_*) importSystemdEnvrionment(); - QStringList args; - if (argc > 1) { - args.reserve(argc); - for (int i = 1; i < argc; ++i) { - args << QString::fromLocal8Bit(argv[i]); - } - } else { - args = QStringList{QStringLiteral("--xwayland"), QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR "/startplasma-waylandsession")}; - } - runSync(QStringLiteral("kwin_wayland_wrapper"), args); + if (!startPlasmaSession(true)) + return 4; + + // Anything after here is logout + // It is not called after shutdown/restart + waitForKonqi(); + out << "startplasma-wayland: Shutting down...\n"; + + // Keep for KF5; remove in KF6 (KInit will be gone then) + runSync(QStringLiteral("kdeinit5_shutdown"), {}); out << "startplasmacompositor: Shutting down...\n"; cleanupPlasmaEnvironment(oldSystemdEnvironment); diff --git a/startkde/startplasma-waylandsession.cpp b/startkde/startplasma-waylandsession.cpp deleted file mode 100644 index 5ddd7ef60..000000000 --- a/startkde/startplasma-waylandsession.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "startplasma.h" -#include - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - signal(SIGTERM, sigtermHandler); - - QScopedPointer ksplash; - - if (!qEnvironmentVariableIsSet("KWIN_RESTART_COUNT")) { - ksplash.reset(setupKSplash()); - } - - out << "startplasma-waylandsession: Starting up...\n"; - - if (!syncDBusEnvironment()) { - out << "Could not sync environment to dbus.\n"; - return 2; - } - - if (!startPlasmaSession(true)) - return 4; - - // Anything after here is logout - // It is not called after shutdown/restart - waitForKonqi(); - out << "startplasma-waylandsession: Shutting down...\n"; - - // Keep for KF5; remove in KF6 (KInit will be gone then) - runSync(QStringLiteral("kdeinit5_shutdown"), {}); - - out << "startplasma-waylandsession: Done.\n"; - - return 0; -} diff --git a/startkde/systemd/plasma-core.target b/startkde/systemd/plasma-core.target index 59eb19442..8f020b4ca 100644 --- a/startkde/systemd/plasma-core.target +++ b/startkde/systemd/plasma-core.target @@ -2,6 +2,5 @@ Description=KDE Plasma Workspace Core Wants=plasma-plasmashell.service plasma-kcminit.service plasma-kded.service plasma-kcminit-phase1.service graphical-session-pre.target Requires=plasma-ksmserver.service -BindsTo=plasma-ksmserver.service -After=graphical-session-pre.target +After=graphical-session-pre.target plasma-kwin_wayland.service RefuseManualStart=yes