Skip to content

🦄 refactor: 改善任务栏歌词兼容性#825

Merged
imsyy merged 2 commits intoimsyy:devfrom
apoint123:refactor/improve-taskbar-compatibility
Feb 5, 2026
Merged

🦄 refactor: 改善任务栏歌词兼容性#825
imsyy merged 2 commits intoimsyy:devfrom
apoint123:refactor/improve-taskbar-compatibility

Conversation

@apoint123
Copy link
Collaborator

改善了任务栏歌词在面对魔改任务栏时的兼容性,现在如果用户在 Windows 11 上使用 Windows 10 的任务栏,应该可以回退到 Windows 10 的实现了

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @apoint123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在显著提升任务栏歌词功能在不同Windows任务栏配置下的兼容性。通过引入更健壮的策略选择和回退机制,特别是针对Windows 11上可能存在的“魔改”任务栏,确保了即使在非标准环境下,歌词也能正常显示。核心改进在于,系统现在能够智能地检测当前任务栏的结构,并在首选策略不适用时,无缝切换到备用策略,从而为用户提供更稳定的体验。

Highlights

  • 策略回退机制优化: 改进了任务栏歌词策略的初始化逻辑,现在会根据Windows版本号优先选择策略,并在首选策略初始化失败时,自动尝试备选策略(例如,在Windows 11上,如果Win11策略失败,会回退到Win10策略)。
  • Win11策略兼容性增强: Win11任务栏策略现在会检查是否存在特定的XAML桥接窗口。如果该桥接窗口不存在,则认为Win11策略不适用(可能因为任务栏被修改),从而触发回退机制。
  • 常量定义集中化: 将BRIDGE_CLASS常量从uia.rs移动到utils.rs并公开,提高了代码的可维护性和组织性。
  • 类型定义文件更新: 为自动生成的index.d.ts文件添加了/* eslint-disable */注释,以避免Linting警告。
Changelog
  • native/taskbar-lyric/src/lib.rs
    • 重构了 create_strategy 函数,引入了主备策略选择和回退逻辑。
    • 根据Windows版本号(>=22000为Win11)确定主备策略的顺序。
    • 如果主策略初始化失败,则尝试初始化备用策略。
  • native/taskbar-lyric/src/strategy/win11.rs
    • init 方法中新增了对XAML桥接窗口(BRIDGE_CLASS)的检查。
    • 如果找不到XAML桥接窗口,Win11策略初始化将失败,从而允许系统回退到其他策略。
    • 导入 BRIDGE_CLASS 常量从 utils 模块。
  • native/taskbar-lyric/src/uia.rs
    • 移除了本地定义的 BRIDGE_CLASS 常量。
    • 现在从 utils 模块导入 BRIDGE_CLASS
  • native/taskbar-lyric/src/utils.rs
    • 新增了 pub const BRIDGE_CLASS 定义,集中管理此常量。
    • 导入 windows_core::PCWSTR
  • native/tools/index.d.ts
    • 在文件顶部添加了 /* eslint-disable */ 注释。
Activity
  • 此拉取请求由apoint123创建,目前没有其他活动记录。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

这次重构做得很好,清晰地分离了 Windows 11 和旧版 Windows 的任务栏歌词策略,并通过优雅的回退机制提高了兼容性,特别是在处理魔改任务栏的场景下。代码逻辑现在更加健壮和易于理解。

我只发现了一个可以改进的小地方:在 win11.rs 中,unsafe 代码块的范围可以收得更紧一些,以符合 Rust 的最佳实践,即将 unsafe 的范围限制在最小必要的代码上。

总体来说,这是一次高质量的改进!

@apoint123 apoint123 force-pushed the refactor/improve-taskbar-compatibility branch from 1ebc7b4 to 3eac75a Compare February 4, 2026 19:23
@imsyy imsyy merged commit 33b1066 into imsyy:dev Feb 5, 2026
@apoint123 apoint123 deleted the refactor/improve-taskbar-compatibility branch February 5, 2026 10:50
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.

2 participants