feat(session): add XDG_CONFIG_DIRS with /usr/share/kwin/xdg fallback - #226
feat(session): add XDG_CONFIG_DIRS with /usr/share/kwin/xdg fallback#226justforlxz wants to merge 1 commit into
Conversation
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配置可级联回退。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: justforlxz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds /usr/share/kwin/xdg as a fallback/config directory for XDG_CONFIG_DIRS in both the session environment manager and profile.d script, ensuring consistent KConfig fallback behavior across login paths. Sequence diagram for XDG_CONFIG_DIRS initialization with kwin fallbacksequenceDiagram
actor User
participant LoginShell
participant deepin_xdg_dir_sh
participant SessionManager
participant EnvironmentsManager
participant KConfig
User->>LoginShell: start_session
LoginShell->>deepin_xdg_dir_sh: source deepin-xdg-dir.sh
deepin_xdg_dir_sh-->>LoginShell: export XDG_CONFIG_DIRS
LoginShell->>SessionManager: start_session_manager
SessionManager->>EnvironmentsManager: createGeneralEnvironments
EnvironmentsManager->>EnvironmentsManager: createGeneralEnvironments
alt [XDG_CONFIG_DIRS is empty]
EnvironmentsManager-->>EnvironmentsManager: set XDG_CONFIG_DIRS=/etc/xdg:/usr/share/kwin/xdg
else [XDG_CONFIG_DIRS is set]
EnvironmentsManager-->>EnvironmentsManager: append :/usr/share/kwin/xdg to XDG_CONFIG_DIRS
end
EnvironmentsManager->>KConfig: read config using XDG_CONFIG_DIRS
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The logic to append
/usr/share/kwin/xdgtoXDG_CONFIG_DIRSis duplicated between the C++ code and the profile script; consider centralizing this path in a single shared definition or at least a common constant to avoid divergence in future changes. - In
EnvironmentsManager::createGeneralEnvironments, you unconditionally append:/usr/share/kwin/xdgifXDG_CONFIG_DIRSis non-empty; it may be worth checking whether the path is already present to avoid duplicating it when the environment is preconfigured.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The logic to append `/usr/share/kwin/xdg` to `XDG_CONFIG_DIRS` is duplicated between the C++ code and the profile script; consider centralizing this path in a single shared definition or at least a common constant to avoid divergence in future changes.
- In `EnvironmentsManager::createGeneralEnvironments`, you unconditionally append `:/usr/share/kwin/xdg` if `XDG_CONFIG_DIRS` is non-empty; it may be worth checking whether the path is already present to avoid duplicating it when the environment is preconfigured.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 {
QString xdgConfigDirs = m_envMap.value("XDG_CONFIG_DIRS");
const QString kwinXdgPath = QStringLiteral("/usr/share/kwin/xdg");
if (xdgConfigDirs.isEmpty()) {
xdgConfigDirs = QStringLiteral("/etc/xdg:") + kwinXdgPath;
} else if (!xdgConfigDirs.contains(kwinXdgPath)) {
xdgConfigDirs += QStringLiteral(":") + kwinXdgPath;
}
m_envMap.insert("XDG_CONFIG_DIRS", xdgConfigDirs);
} |
Add /usr/share/kwin/xdg to XDG_CONFIG_DIRS in both profile.d script and EnvironmentsManager C++ code to support KConfig file fallback.
PMS: TASK-377491
Summary by Sourcery
New Features: