Skip to content

fix(desktop): use native tray context menu - #827

Merged
seed30 merged 2 commits into
TencentCloud:developfrom
JY-M666:fix/issue-698-tray-context-menu
Nov 4, 2026
Merged

seed30 merged 2 commits into
TencentCloud:developfrom
JY-M666:fix/issue-698-tray-context-menu

Conversation

@JY-M666

@JY-M666 JY-M666 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes [bug] 托盘右键菜单打开时会收起系统托盘,不符合操作预期 #698.
  • Replace the custom settings-window right-click handler with a native Wails tray menu so opening the menu does not collapse the Windows tray overflow area.
  • Keep the existing attached settings window and platform-specific left-click behavior.
  • Add localized menu labels for Settings, Show Octop, and Quit.
  • Rebuild the native tray menu immediately when the saved locale changes, with regression coverage for both locale changes and unchanged locales.

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

  • cd desktop/src && go test ./...

  • cd desktop/src && go vet ./...

  • git diff --check

  • make all was not run because GNU Make is unavailable in the Windows environment; the changed desktop Go module was tested directly with Go 1.25.14.

  • make all passes locally

  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed) — no documentation change is needed for this behavior-only fix

@jubaoliang

Copy link
Copy Markdown
Collaborator

Maintainer triage

需求合理(#698):用原生 Wails tray menu 替代自定义右键,避免 Windows 托盘溢出区被收起。

合并前请:

  1. 对最新 develop rebase / 解决冲突(当前 CONFLICTING)。
  2. 确认桌面相关测试(tray_menu_test.go 等)与手动:Win 托盘左键/右键、Settings / Show / Quit 文案与行为。
  3. 冲突解决后 @ 维护者再合。

暂不直接合并。

@JY-M666
JY-M666 force-pushed the fix/issue-698-tray-context-menu branch from 9aac5dc to 8b5fbc3 Compare September 19, 2026 12:57
@JY-M666

JY-M666 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

@jubaoliang 已 rebase 到最新 develop(474d25a)并解决 CHANGELOG.md 冲突,当前 PR 已恢复为 mergeable。develop 中已有的两条 Unreleased 修复记录均已保留。cd desktop/src && go test ./...、go vet ./...、git diff --check origin/develop...HEAD 均通过。当前终端环境无法可靠代替人工点击 Windows 系统托盘,因此未声称完成左键/右键及 Settings / Show / Quit 的手动交互验证;该项仍需人工确认。

@JY-M666

JY-M666 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

@jubaoliang darwin-amd64 本次失败发生在 go mod tidy 下载既有依赖阶段,访问 proxy.golang.org 超时;同一 SHA 的 darwin-arm64、windows-amd64、windows-arm64 均已通过,判断为临时 CI 网络故障。外部贡献者账号无 Actions 重跑权限(GitHub 返回 Must have admin rights to Repository),麻烦维护者方便时重跑失败 job,谢谢。

@dangzitou dangzitou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(以下为外部贡献者的审查建议,不代表 maintainer 的合入批准。)

原生托盘菜单本身没问题,但有一个生命周期 bug:菜单只在启动时用当时的语言构建了一次(desktop/src/main.go:392:tray.SetMenu(newTrayMenu(store.get().Locale, ...))),而没有任何地方在语言切换后重建它——SaveSettings 只调 applyDashboardPrefs(同步 dashboard 的 localStorage)与 setStatus,托盘菜单的 label 不会更新。用户在设置里把语言从 English 切成中文后,右键菜单会一直显示旧语言,直到重启应用。

建议:把 menu 存成 App 的字段,在 SaveSettings 里检测到 locale 变化时用新语言重建并重新 tray.SetMenu(...);其他会改语言的入口(如设置窗口内的即时切换,若有)同样要触发重建。

(本地没有 Go 工具链,以上为代码走查结论;新增的 tray_menu_test.go 只覆盖了标签本地化,没有覆盖语言切换后的重建。)

@jubaoliang

Copy link
Copy Markdown
Collaborator

方向对:自定义托盘右键在部分平台会把菜单打塌,改用原生菜单合理。

之前 rebase 之后 develop 又往前走了,当前再次与 develop 冲突。请再 rebase 一次解掉冲突。darwin-amd64 若仍停在 go mod tidy 访问 proxy.golang.org 超时,那是 CI 网络,不是这个改动本身。

@JY-M666
JY-M666 force-pushed the fix/issue-698-tray-context-menu branch from 8b5fbc3 to 3b6e3b8 Compare September 21, 2026 07:23
@JY-M666

JY-M666 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

@jubaoliang @dangzitou 已按反馈更新:3b6e3b82 已 rebase 到最新 develop(29732673),并在 SaveSettings 保存语言变更后通过 tray.SetMenu(...) 立即重建原生托盘菜单;语言未变化时不会重复重建。新增测试覆盖 English → 中文后的菜单标签刷新以及 locale 不变场景。cd desktop/src && go test ./...、go vet ./...、git diff --check origin/develop...HEAD 均已通过。Windows 托盘实际点击交互仍保留为人工验证项。

@JY-M666

JY-M666 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

补充本轮 CI 诊断:四个 Desktop Package 平台(darwin-arm64 / darwin-amd64 / windows-amd64 / windows-arm64)均在 Assemble green zip 的依赖安装阶段失败,错误一致为 Distribution not found at: file:///.../Octop/harness-agent。最新 develop 的 uv.lock 将 orcakit-harness-agent 记录为 source = { editable = "../harness-agent" },该行由上游提交 12e5b706 引入;本 PR 的 diff 不包含 uv.lock、pyproject.toml 或打包脚本。因此这是当前 develop 的打包基线问题,不是 Issue #698 的托盘改动导致。对应 workflow run:https://github.com/TencentCloud/Octop/actions/runs/35572720717 。常规 CI 的 install / lint / type-check 已通过,测试阶段仍在运行。

@JY-M666
JY-M666 force-pushed the fix/issue-698-tray-context-menu branch from 3b6e3b8 to 368ae82 Compare September 22, 2026 09:57
@JY-M666

JY-M666 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@jubaoliang 已将本 PR rebase 到最新 develop(21760bbf),重写后的提交为 368ae827。新旧提交的 stable patch-id 完全一致,功能 diff 未发生变化。

最新基线已将 orcakit-harness-agent 从不存在的本地 editable 路径恢复为 PyPI >=1.0.13,此前 Desktop Package 的基线阻塞应可通过本轮 CI 重新验证。

git diff --check origin/develop...HEAD 已通过。当前环境没有 Go 工具链,因此本轮未重复执行 Go 测试,等待 CI 验收。Windows 托盘实际点击交互仍保留为人工验证项。

@JY-M666
JY-M666 force-pushed the fix/issue-698-tray-context-menu branch from 368ae82 to b0b6550 Compare September 26, 2026 08:41
@JY-M666
JY-M666 force-pushed the fix/issue-698-tray-context-menu branch from b0b6550 to 93d882d Compare October 15, 2026 03:23
@JY-M666

JY-M666 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@jubaoliang 已同步最新 develop(a8b3bfff),解决 CHANGELOG 和桌面文案冲突,保留上游改动。

Windows 开发版桌面外壳已由贡献者手动验证:右键菜单不收起隐藏托盘面板,Settings、左键显示、Show Octop、Quit 均正常,切换中文后菜单立即刷新,无需重启。

托盘专项测试、开发版编译及生产代码静态检查通过。完整桌面测试仍受上游 filedrop_test.go 重复声明及 Windows 监听探测测试失败阻塞,未修改的 develop 同样复现;未声称全量测试通过。本次不扩大修复范围,烦请复审。

@seed30

seed30 commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献,麻烦解决下冲突,我来进行合入

@seed30
seed30 merged commit 01cfc50 into TencentCloud:develop Nov 4, 2026
10 checks passed
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.

4 participants