feat: sessionFieldOverrides for override Exec key in a given session - #379
feat: sessionFieldOverrides for override Exec key in a given session#379BLumia wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia 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 GuideAdds a DConfig-driven, session-specific override mechanism for desktop file Exec/TryExec and environment variables, wires it through application creation/autostart checks, and introduces supporting SessionOverrideConfig and SessionType helpers with unit tests. Sequence diagram for Exec and Env resolution with session overridessequenceDiagram
participant AMS as ApplicationManager1Service
participant AS as ApplicationService
participant CM as CompatibilityManager
participant SOC as SessionOverrideConfig
AMS->>AS: createApplicationService(...)
AMS->>AMS: getSessionOverrideConfig()
AMS->>AS: shouldBeShown(entry, desktopId, sessionConfig)
AS->>CM: getCompatibilityManager()
AS->>AS: processCompatibility(action, options, execStr)
Note over AS: originalExec = execStr
AS->>CM: getExec(desktopId)
AS->>AS: apply compatibility Exec/env
AS->>AMS: parent().getSessionOverrideConfig()
AS->>SOC: getValue(desktopId, groupKey, DesktopEntryExec)
alt Exec override exists
AS->>SOC: resolveExecValue(overrideExec, originalExec)
AS->>AS: execStr = resolvedExec
end
AS->>SOC: getEnv(desktopId, groupKey)
alt Env overrides not empty
AS->>AS: merge Env into options[EnvKey]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
c0c75c0 to
ea88ef1
Compare
| "name": "Session-specific Exec override", | ||
| "name[zh_CN]": "会话感知的 Exec 覆盖", | ||
| "description": "Overrides the Exec field. Supports !AM_FULL! placeholder.", | ||
| "permissions": "readwrite", |
| "name": "Session-specific TryExec override", | ||
| "name[zh_CN]": "会话感知的 TryExec 覆盖", | ||
| "description": "Overrides the TryExec field. Empty string forces the app to be shown.", | ||
| "permissions": "readwrite", |
| "visibility": "public" | ||
| } | ||
| } | ||
| } No newline at end of file |
| return it->second.get(); | ||
|
|
||
| const auto subpath = m_subpathPrefix % u"/"_s % desktopId; | ||
| auto *config = DConfig::create(fromStaticRaw(ApplicationServiceID), |
There was a problem hiding this comment.
用dconfig提供的cmake来生成代码,不要直接用dconfig类。
ea88ef1 to
d189844
Compare
新增 DConfig 配置项,允许为指定会话(例如wayland)覆盖指定desktop文件中 的Exec/TryExec字段的值. 实际场景为解决部分应用程序默认Exec字段的参数会无法在treeland下表现良 好的问题. Log:
d189844 to
f7468cd
Compare
deepin pr auto review★ 总体评分:80分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/src/sessionoverrideconfig.cpp b/src/sessionoverrideconfig.cpp
index 37e88239..00000000
--- a/src/sessionoverrideconfig.cpp
+++ b/src/sessionoverrideconfig.cpp
@@ -89,6 +89,9 @@ ApplicationOverrideConfig *SessionOverrideConfig::configFor(const QString &deskto
});
m_configs[desktopId] = std::unique_ptr<ApplicationOverrideConfig>(config);
+
+ // Load initial values immediately after creation
+ updateOverride(desktopId);
+
return config;
} |
新增 DConfig 配置项,允许为指定会话(例如wayland)覆盖指定desktop文件中
的Exec/TryExec字段的值.
配置格式大致为
/usr/share/dsg/configs/overrides/org.deepin.dde.application-manager/org.deepin.dde.am.appoverride/x11/example.app-id/90-override.json{ "magic": "dsg.config.override", "version": "1.0", "contents": { "Exec": { "value": "notify-send 'test am override'" } } }配置好后使用这个命令验证配置项是否正确:
dde-dconfig get -a org.deepin.dde.application-manager -r org.deepin.dde.am.appoverride -s /x11/example.app-id -k Exec实际场景为解决部分应用程序默认Exec字段的参数会无法在treeland下表现良
好的问题.
Log:
Summary by Sourcery
Introduce session-aware configuration to override desktop file Exec/TryExec and environment fields per session and integrate it into application filtering and autostart handling.
Enhancements:
Tests: