From 86606fbcbf75ebcbaa341984ec7bf71243dd9c75 Mon Sep 17 00:00:00 2001 From: justforlxz Date: Tue, 18 Aug 2026 19:27:35 +0800 Subject: [PATCH] feat(session): add XDG_CONFIG_DIRS with /usr/share/kwin/xdg fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add /usr/share/kwin/xdg to XDG_CONFIG_DIRS in both profile.d script and EnvironmentsManager C++ code to support KConfig file fallback. 在profile.d脚本和EnvironmentsManager C++代码中添加 XDG_CONFIG_DIRS,包含/usr/share/kwin/xdg回退路径。 Log: 添加XDG_CONFIG_DIRS支持KConfig配置文件回退 PMS: TASK-377491 Influence: 系统启动后XDG_CONFIG_DIRS包含/usr/share/kwin/xdg,KDE配置可级联回退。 --- misc/profile.d/deepin-xdg-dir.sh | 1 + src/dde-session/environmentsmanager.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/misc/profile.d/deepin-xdg-dir.sh b/misc/profile.d/deepin-xdg-dir.sh index d47eda0..8af95f4 100644 --- a/misc/profile.d/deepin-xdg-dir.sh +++ b/misc/profile.d/deepin-xdg-dir.sh @@ -1,6 +1,7 @@ export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" +export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}:/usr/share/kwin/xdg" #export XDG_DESKTOP_DIR="$HOME/Desktop" #export XDG_DOCUMENTS_DIR="$HOME/Documents" diff --git a/src/dde-session/environmentsmanager.cpp b/src/dde-session/environmentsmanager.cpp index 4a99128..9daa0d9 100644 --- a/src/dde-session/environmentsmanager.cpp +++ b/src/dde-session/environmentsmanager.cpp @@ -110,6 +110,16 @@ void EnvironmentsManager::createGeneralEnvironments() m_envMap.insert("XDG_CURRENT_DESKTOP", "DDE"); m_envMap.insert("QT_DBL_CLICK_DIST", QString::number(15 * scaleFactor)); + { + QString xdgConfigDirs = m_envMap.value("XDG_CONFIG_DIRS"); + if (xdgConfigDirs.isEmpty()) { + xdgConfigDirs = QStringLiteral("/etc/xdg:/usr/share/kwin/xdg"); + } else { + xdgConfigDirs += QStringLiteral(":/usr/share/kwin/xdg"); + } + m_envMap.insert("XDG_CONFIG_DIRS", xdgConfigDirs); + } + if (sessionType == "x11") { m_envMap.insert("QT_QPA_PLATFORM", "dxcb;xcb"); } else if (sessionType == "wayland") {