feat(gui): 任务栏图标运行状态指示(变色 + 数量圆点) - #280
Open
inkdust2021 wants to merge 1 commit into
Open
Conversation
Mirror the number of running conversations onto the desktop shell so users can see agent progress without focusing the window: - Windows: tint the taskbar icon amber while tasks run and overlay a red badge showing the count (1-9, then 9+) rendered from an embedded 3x5 bitmap font — no new dependencies. Both reset when idle. - macOS: native Dock badge via set_badge_count (Dock icon tinting is not exposed by Tauri 2.11.5). - Linux: set_badge_count best effort (Unity-style desktops). The frontend syncs runningConversationIds.size through the new taskbar_set_activity command and clears the badge on unmount.
coder-hhx
reviewed
Jul 27, 2026
coder-hhx
left a comment
Collaborator
There was a problem hiding this comment.
复核最新提交 feac4dd2,确认有一项 Windows 图标恢复问题:
P3 · 请恢复 Tauri 实际配置的默认窗口图标
crates/agent-gui/src/pages/chat/hooks/useTaskbarActivity.ts:16 会在首次挂载时立即发送 count = 0,因此 crates/agent-gui/src-tauri/src/commands/app/taskbar.rs:70 在应用刚启动、尚无任务时就会替换启动图标。
当前 Windows 配置使用 icons/icon-windows.ico。Tauri 2.11.5 / tauri-codegen 2.6.3 会从该 ICO 的第一个 16×16 frame 构造默认窗口图标;这里却用 128x128-windows.png 调用 set_icon()。这不是恢复原始 icon,而是换成另一个尺寸的 HICON,标题栏/任务栏图标可能发生可见变化或被重新缩放。每次任务归零也会重复替换。
建议从 window.app_handle().default_window_icon() 恢复 Tauri 实际使用的默认图标(或在首次变色前保存原 icon),不要用单独的 PNG 作为“原状”。现有 Rust 测试覆盖了角标绘制,但没有覆盖默认图标恢复语义。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能
有任务(会话正在生成回复)进行时,任务栏/Dock 图标给出可见指示;全部结束后自动恢复原状:
set_icon换成琥珀色着色图标set_overlay_icon叠加红底白字角标(1-9,超过显示 9+)set_badge_count原生 Dock 红点数字set_badge_count尽力而为(Unity 系桌面)实现
ChatPage已维护并发运行会话集合runningConversationIds,新增useTaskbarActivityhook 把size经新命令taskbar_set_activity同步给桌面端;组件卸载时清零,invoke 失败静默(不影响聊天主流程)。commands/app/taskbar.rs):128x128-windows.png上做 55% 琥珀色线性混合,双双缓存于OnceLock;#[cfg]分发。验证
cargo test taskbar --lib:4 个单元测试通过(字形上限 9+、圆形角标透明边界与文字像素、不同数量渲染差异、着色保留 alpha);set_overlay_icon/set_icon/Image::*)已在x86_64-pc-windows-msvc目标下编译验证;tsc、biome(触及文件零新增告警)、pnpm test:frontend(1285 通过)、mirror check(109 文件)、git diff --check全部通过;