From 4340284201463d6c3c9b2945ad3b5e3ddd47e68e Mon Sep 17 00:00:00 2001 From: zhangkun Date: Mon, 7 Sep 2026 18:16:40 +0800 Subject: [PATCH] feat(session): launch nodbus shutdown overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Start the installed dde-blackwidget-nodbus service before shutdown and reboot preparation. 2. Call the existing systemd Manager StartUnit D-Bus method directly and wait for its reply instead of spawning systemctl. 3. Restrict startup to X11 while keeping the service outside the session lifetime. 4. Require dde-session-ui newer than 6.0.48 to provide the nodbus service unit. Log: Start the nodbus overlay directly through the systemd user manager before shutdown and reboot. Influence: Start the overlay without a helper process. feat(session): 启动 nodbus 关机遮罩 1. 在关机和重启准备前启动已安装的 dde-blackwidget-nodbus 服务。 2. 直接调用现有 systemd Manager 的 StartUnit D-Bus 方法并等待响应,不再拉起 systemctl 进程。 3. 仅在 X11 下启动,并使服务生命周期独立于当前会话。 4. 要求高于 6.0.48 的 dde-session-ui,以提供 nodbus 服务单元。 Log: 在关机和重启前通过 systemd 用户管理器直接启动 nodbus 遮罩。 PMS: TASK-395319 Influence: 无需辅助进程即可启动遮罩。 Change-Id: I2460ed206d8b77d94adfefde282b3dfaa355d6c7 --- debian/control | 1 + src/dde-session/impl/sessionmanager.cpp | 21 +++++++++++++++++++++ src/dde-session/impl/sessionmanager.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/debian/control b/debian/control index d05cfc6..32d793e 100644 --- a/debian/control +++ b/debian/control @@ -26,6 +26,7 @@ Depends: jq, sed (>= 4), dde-daemon (>= 6.1.102), + dde-session-ui (>> 6.0.48), deepin-security-loader, libdtkdata (>=5.7.18), libdtk6core (>=6.0.38), diff --git a/src/dde-session/impl/sessionmanager.cpp b/src/dde-session/impl/sessionmanager.cpp index e58608f..2999ea6 100644 --- a/src/dde-session/impl/sessionmanager.cpp +++ b/src/dde-session/impl/sessionmanager.cpp @@ -947,8 +947,28 @@ void SessionManager::recoverySystemPowerMode() setTlpMode(mode); } +void SessionManager::startBlackWidget() +{ + if (Utils::IS_WAYLAND_DISPLAY) { + qInfo() << "skip start blackwidget on wayland"; + return; + } + + qInfo() << "start dde-blackwidget nodbus for shutdown"; + QDBusPendingReply reply = + m_systemd1ManagerInter->StartUnit(QStringLiteral("dde-blackwidget-nodbus.service"), + QStringLiteral("replace")); + reply.waitForFinished(); + if (reply.isError()) { + qWarning() << "failed to start dde-blackwidget-nodbus.service:" + << reply.error().name() + << reply.error().message(); + } +} + void SessionManager::shutdown(bool force) { + startBlackWidget(); prepareShutdown(force); clearCurrentTty(); @@ -962,6 +982,7 @@ void SessionManager::shutdown(bool force) void SessionManager::reboot(bool force) { + startBlackWidget(); prepareShutdown(force); clearCurrentTty(); diff --git a/src/dde-session/impl/sessionmanager.h b/src/dde-session/impl/sessionmanager.h index d06d27f..324d6f4 100644 --- a/src/dde-session/impl/sessionmanager.h +++ b/src/dde-session/impl/sessionmanager.h @@ -98,6 +98,8 @@ public Q_SLOTS: void playLogoutSound(); void setDPMSMode(bool on); + void startBlackWidget(); + void handleOSSignal(); void watchXConnection();