Skip to content

feat: add dbus-activatable desktop entry for dde-shell#1600

Open
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:desktop
Open

feat: add dbus-activatable desktop entry for dde-shell#1600
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:desktop

Conversation

@18202781743
Copy link
Copy Markdown
Contributor

  1. Add a new desktop entry file org.deepin.dde-shell.desktop in the
    misc directory
  2. Configure the entry as a DBusActivatable application with Exec and
    TryExec set to /bin/false
  3. Set NoDisplay to true to hide from menus and launchers
  4. Categorize it under System for organization purposes
  5. This enables the DDE shell service to be started on demand via D-
    Bus activation

Log: Added D-Bus activation support for DDE Shell service

Influence:

  1. Verify that dde-shell can be activated via D-Bus when needed
  2. Test that the entry does not appear in application menus or launchers
  3. Confirm that the service starts on demand and stops when no longer
    needed

feat: 为 dde-shell 添加 D-Bus 激活的 desktop 条目

  1. 在 misc 目录中添加新的 desktop 文件 org.deepin.dde-shell.desktop
  2. 配置该条目为 DBusActivatable 应用,Exec 和 TryExec 设置为 /bin/false
  3. 设置 NoDisplay 为 true 以隐藏于菜单和启动器中
  4. 归类到 System 类别以便于组织管理
  5. 这使得 DDE shell 服务可以通过 D-Bus 激活按需启动

Log: 新增 DDE Shell 服务的 D-Bus 激活支持

Influence:

  1. 验证 dde-shell 能否在需要时通过 D-Bus 激活
  2. 测试该条目不会出现在应用菜单或启动器中
  3. 确认服务按需启动并在不需要时自动停止

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Type=Application
Name=Deepin Desktop Shell
Comment=Deepin desktop shell service
Icon=dde-shell
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个icon在哪,是放到图标主题?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个想着放在主题里,dde-shell内置一个基础的,现在设计的图标还没出,

1. Add a new desktop entry file org.deepin.dde-shell.desktop in the
misc directory
2. Configure the entry as a DBusActivatable application with Exec and
TryExec set to /bin/false
3. Set NoDisplay to true to hide from menus and launchers
4. Categorize it under System for organization purposes
5. This enables the DDE shell service to be started on demand via D-
Bus activation

Log: Added D-Bus activation support for DDE Shell service

Influence:
1. Verify that dde-shell can be activated via D-Bus when needed
2. Test that the entry does not appear in application menus or launchers
3. Confirm that the service starts on demand and stops when no longer
needed

feat: 为 dde-shell 添加 D-Bus 激活的 desktop 条目

1. 在 misc 目录中添加新的 desktop 文件 org.deepin.dde-shell.desktop
2. 配置该条目为 DBusActivatable 应用,Exec 和 TryExec 设置为 /bin/false
3. 设置 NoDisplay 为 true 以隐藏于菜单和启动器中
4. 归类到 System 类别以便于组织管理
5. 这使得 DDE shell 服务可以通过 D-Bus 激活按需启动

Log: 新增 DDE Shell 服务的 D-Bus 激活支持

Influence:
1. 验证 dde-shell 能否在需要时通过 D-Bus 激活
2. 测试该条目不会出现在应用菜单或启动器中
3. 确认服务按需启动并在不需要时自动停止
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

你好!我是CodeGeeX。我已仔细审查了你提供的 Git Diff。本次修改主要为 dde-shell 添加了 DBus 激活支持,通过新增 .desktop 文件并在代码中设置 desktopFileName 来实现,同时更新了构建和打包脚本,以及版权声明年份。

以下是我对本次代码变更在语法逻辑、代码质量、代码性能和代码安全方面的审查意见及改进建议:

1. 语法与逻辑

  • .desktop 文件逻辑(重点关注)
    • 新增的 misc/org.deepin.dde-shell.desktop 中设置了 Exec=/bin/falseTryExec=/bin/false,同时开启了 DBusActivatable=true。这种组合在 DBus 激活的应用中是常见且逻辑正确的,目的是防止用户手动启动该应用(因为它是后台服务,应由 DBus 按需拉起),/bin/false 会立即返回失败,确保不会产生僵尸进程。
    • 潜在问题:在某些桌面环境或文件管理器中,如果它们没有正确处理 DBusActivatable 而是尝试直接执行 Exec,可能会引发不明确的错误提示。
    • 改进建议:建议将 Exec 设置为空字符串 Exec=,这在规范中表示该应用无法通过命令行启动,比指向 /bin/false 语义更清晰,且避免了不必要的系统调用。

2. 代码质量

  • 版权声明年份格式
    • shell/CMakeLists.txtshell/main.cpp 中,版权年份从 2023 修改为了 2023 - 2026
    • 问题:通常版权声明的年份范围应表示过去到当前的年份(如 2023 - 2024)。将结束年份设置为未来的 2026 是不规范的,可能是笔误或过度前瞻。
    • 改进建议:将年份更改为当前年份,例如 2023 - 2024。如果项目有自动化脚本更新版权年份,建议修正该脚本的逻辑。
  • 打包路径通配符
    • debian/dde-shell.install 中新增了 usr/share/applications/*
    • 问题:使用通配符 * 会将该目录下的所有文件都打包进 dde-shell 包中。如果未来该目录下混入了其他测试用或无关的 .desktop 文件,会导致打包污染。
    • 改进建议:建议明确指定文件名,提高打包的严谨性:usr/share/applications/org.deepin.dde-shell.desktop

3. 代码性能

  • main.cpp 中的字符串构造
    • 新增代码 a.setDesktopFileName(QStringLiteral("org.deepin.dde-shell")); 使用了 QStringLiteral
    • 评价:这非常棒!QStringLiteral 在编译期生成字符串数据,运行时零开销构造 QString,是 Qt 编程中优化性能的最佳实践。此处无需修改。

4. 代码安全

  • .desktop 文件权限与完整性
    • .desktop 文件通常由系统包管理器安装,权限默认为 644,这没有问题。
    • 但如果应用在运行时动态查找或解析 .desktop 文件,需注意防范路径遍历或符号链接替换攻击。由于此处是通过 CMake install 静态安装,且 desktopFileName 是硬编码的,安全风险极低。
  • DBus 激活安全
    • 启用 DBusActivatable=true 意味着 DBus 守护进程会负责拉起 dde-shell。请确保在系统的 DBus 服务配置文件(如 usr/share/dbus-1/services/org.deepin.dde-shell.service)中,指向的可执行文件路径是绝对路径且不可被普通用户篡改(即位于系统只读目录如 /usr/bin/usr/libexec 下)。

综合修改建议代码

基于以上分析,我建议对 .desktop 文件和打包配置进行微调:

1. 修改后的 misc/org.deepin.dde-shell.desktop

[Desktop Entry]
Type=Application
Name=Deepin Desktop Shell
Comment=Deepin desktop shell service
Icon=dde-shell
Exec=
TryExec=
DBusActivatable=true
NoDisplay=true
Terminal=false
StartupNotify=false
Categories=System;

2. 修改后的 debian/dde-shell.install (相关行):

usr/share/applications/org.deepin.dde-shell.desktop

3. 修改后的版权声明(以 main.cpp 为例):

// SPDX-FileCopyrightText: 2023 - 2024 UnionTech Software Technology Co., Ltd.

总体而言,这是一个结构清晰、目的明确的 PR,主要逻辑没有问题,只需在细节规范上稍加完善即可。希望这些意见对你有所帮助!

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 20, 2026

TAG Bot

New tag: 2.0.42
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants