From 657ce7aa6f451cfe0b64770c85478d3f3818a381 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Thu, 17 Jul 2025 05:49:23 +0000 Subject: [PATCH] sync: from linuxdeepin/dde-session-shell Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: https://github.com/linuxdeepin/dde-session-shell/pull/29 --- CMakeLists.txt | 6 ++-- configs/org.deepin.dde.lock.json | 2 +- files/wayland/lightdm-deepin-greeter-wayland | 33 ++++++++++++++++++++ src/session-widgets/sessionbasemodel.cpp | 27 +++++++++++++--- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c33ff56f5..283ed3acb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -401,7 +401,7 @@ add_subdirectory(src/pam-inhibit-autologin) if (DISABLE_DSS_SNIPE) # bin install(TARGETS dde-lock lightdm-deepin-greeter greeter-display-setting DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(FILES files/deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(PROGRAMS files/deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR}) # install x files file(GLOB SCRIPTS @@ -419,7 +419,7 @@ if (DISABLE_DSS_SNIPE) install(FILES files/wayland/lightdm-deepin-greeter-wayland.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/xgreeters/) else () # snipe install(TARGETS dde-lock lightdm-deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(FILES files/snipe/deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(PROGRAMS files/snipe/deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR}) file(GLOB SCRIPTS files/snipe/scripts/*) install(PROGRAMS ${SCRIPTS} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/deepin/greeters.d) @@ -490,4 +490,4 @@ endif () install(FILES files/deepin-debug-config/org.deepin.dde.session-shell.json DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-debug-config/deepin-debug-config.d) install(FILES files/deepin-log-config/org.deepin.dde.session-shell.json - DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-log-viewer/deepin-log.conf.d) \ No newline at end of file + DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-log-viewer/deepin-log.conf.d) diff --git a/configs/org.deepin.dde.lock.json b/configs/org.deepin.dde.lock.json index 370146add..2de40b78c 100755 --- a/configs/org.deepin.dde.lock.json +++ b/configs/org.deepin.dde.lock.json @@ -53,7 +53,7 @@ "visibility": "private" }, "enableShortcutForLock":{ - "value": ["Screenshot","Screen Recorder","Full screenshot"], + "value": ["Screenshot","Screen Recorder","Full screenshot","WLAN"], "serial": 0, "flags": [], "name": "EnableShortcutForLock", diff --git a/files/wayland/lightdm-deepin-greeter-wayland b/files/wayland/lightdm-deepin-greeter-wayland index 5656b3c59..e9493a940 100755 --- a/files/wayland/lightdm-deepin-greeter-wayland +++ b/files/wayland/lightdm-deepin-greeter-wayland @@ -15,4 +15,37 @@ if [ -x $display_daemon ]; then fi +#在满足条件下,设置tapToClick=true +#解析dbus信息输出 +dbus_values_get_strings(){ + local input="$1" + echo "$input" | grep -oP 'string \K".*?"' | tr -d '"' +} +dbus_values_get_bool(){ + local input="$1" + echo "$input" | grep -oP 'boolean \Ktrue|false' | awk '{print $1}' +} + +#判断并设置设备属性 +device_handle(){ + local input="$1" + local dbus_touchpad=$(dbus-send --session --print-reply --dest=org.kde.KWin $input org.freedesktop.DBus.Properties.Get string:"org.kde.KWin.InputDevice" string:"touchpad") + local touchpad=$(dbus_values_get_bool "$dbus_touchpad") + + if [ "$touchpad" = "true" ]; then + dbus-send --session --dest=org.kde.KWin "$input" org.freedesktop.DBus.Properties.Set string:"org.kde.KWin.InputDevice" string:"tapToClick" variant:boolean:true + fi +} + +#获取设备列表 +dbus_devices=$(dbus-send --session --print-reply --dest=org.kde.KWin /org/kde/KWin/InputDevice org.freedesktop.DBus.Properties.Get string:"org.kde.KWin.InputDeviceManager" string:"devicesSysNames") +devices_strings=$(dbus_values_get_strings "$dbus_devices") + +#遍历设备列表 +device_path="/org/kde/KWin/InputDevice/" +for dev in $devices_strings; do + path="${device_path}${dev}" + device_handle "$path" +done + /usr/share/dde-session-shell/greeters.d/launch-binary diff --git a/src/session-widgets/sessionbasemodel.cpp b/src/session-widgets/sessionbasemodel.cpp index d323ac16d..1dd532120 100644 --- a/src/session-widgets/sessionbasemodel.cpp +++ b/src/session-widgets/sessionbasemodel.cpp @@ -3,13 +3,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "sessionbasemodel.h" +#include "dconfig_helper.h" +#include "dbus/dbusdisplaymanager.h" #include - #include #include "dbusconstant.h" -#include "dconfig_helper.h" DCORE_USE_NAMESPACE @@ -462,6 +462,22 @@ void SessionBaseModel::updateUserList(const QStringList &list) void SessionBaseModel::updateLoginedUserList(const QString &list) { qCDebug(DDE_SHELL) << "Logined user list: " << list; + // kwin崩溃时systemd中的sessions不会被remove掉,这里通过DisplayManager的session信息过滤一遍(临时解决方案) + QStringList loggedUserNameList; + DBusDisplayManager displayManager("org.freedesktop.DisplayManager", "/org/freedesktop/DisplayManager", QDBusConnection::systemBus()); + const auto &sessions = displayManager.sessions(); + for (const auto &session : sessions) { + const QString &sessionPath = session.path(); + if (sessionPath.isEmpty()) + continue; + QDBusInterface interface("org.freedesktop.DisplayManager", sessionPath, "org.freedesktop.DisplayManager.Session", QDBusConnection::systemBus()); + if (interface.isValid()) { + const QString &userName = interface.property("UserName").toString(); + if (!userName.isEmpty()) + loggedUserNameList.append(userName); + } + } + qInfo(DDE_SHELL) << "Logined users from display manager: " << loggedUserNameList; QList loginedUsersTmp = m_loginedUsers->keys(); QJsonParseError jsonParseError; @@ -486,8 +502,11 @@ void SessionBaseModel::updateLoginedUserList(const QString &list) // 对于通过自定义窗口输入的账户(域账户), 此时账户还没添加进来,导致下面m_users->value(path)为空指针,调用会导致程序奔溃 // 因此在登录时,对于新增的账户,调用addUser先将账户添加进来,然后再去更新对应账户的登录状态 addUser(path); - m_loginedUsers->insert(path, m_users->value(path)); - m_users->value(path)->updateLoginState(true); + auto user = m_users->value(path); + if (user->name().isEmpty() || loggedUserNameList.contains(user->name())) { + m_loginedUsers->insert(path, user); + user->updateLoginState(true); + } } else { loginedUsersTmp.removeAll(path); }