Skip to content

Conversation

@apoint123
Copy link
Collaborator

添加了基础的任务栏歌词功能,歌词的动画效果是基本没有的,只是打好了基础,接下来可以直接写vue和ts代码,应该不用再写原生代码了

@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!

此拉取请求的核心目标是为应用程序添加任务栏歌词功能,提升用户体验。通过引入一个专门的Rust原生模块,实现了与Windows任务栏的深度集成,能够将歌词窗口嵌入到任务栏中,并根据系统状态动态调整其显示。这一改动为后续在Vue和TypeScript中开发更丰富的歌词动画和交互奠定了坚实的基础,同时最大程度地减少了对原生代码的直接修改。

Highlights

  • 任务栏歌词功能: 新增了基础的任务栏歌词功能,允许用户在Windows任务栏上显示当前播放歌曲的歌词。
  • Rust原生模块集成: 引入了一个新的Rust原生模块 taskbar-lyric,用于处理Windows任务栏的窗口嵌入、布局计算和注册表监听,以实现歌词窗口与任务栏的无缝集成。
  • IPC通信机制: 建立了Electron主进程与渲染进程之间关于任务栏歌词的IPC通信,包括歌词数据、播放状态、歌曲元数据和布局更新等。
  • 动态布局与主题适应: 任务栏歌词窗口能够根据Windows任务栏的对齐方式(居中或靠左/右)和是否有小组件显示来动态调整其位置和布局。同时,它还能响应系统主题变化(深色/浅色模式)。
  • 构建流程更新: 更新了构建脚本和依赖配置,以支持新的Rust原生模块的编译和打包,确保其在Electron应用中的正确加载和运行。
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

This pull request introduces a new feature: taskbar lyrics. It includes changes to Cargo.lock and Cargo.toml to add the taskbar-lyric crate as a dependency, modifications to electron-builder.config.ts and electron.vite.config.ts to handle the new native module, and additions to electron/main to manage the taskbar lyric window and IPC. The new taskbar-lyric crate contains Rust code for embedding the lyric window in the taskbar and handling system events. The code introduces a new window, IPC handlers, and store configurations for managing the taskbar lyrics. I have identified some areas for improvement, mainly focusing on error handling and code clarity.

const envEnabled = store.get("taskbar.enabled");

const tray = getMainTray();
tray?.setTaskbarLyricShow(envEnabled);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

It's good to see the tray icon being updated based on the taskbar lyric state. However, consider adding a check to ensure tray is not null before calling setTaskbarLyricShow. This will prevent potential errors if the tray hasn't been initialized yet.

  if (tray) {
    tray.setTaskbarLyricShow(envEnabled);
  }

Comment on lines +21 to +22
const tray = getMainTray();
tray?.setTaskbarLyricShow(show);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the previous comment, ensure tray is not null before calling setTaskbarLyricShow here as well.

    if (tray) {
      tray.setTaskbarLyricShow(show);
    }

Comment on lines +88 to +90
} catch (e) {
processLog.error("[TaskbarLyric] 创建注册表监听器失败", e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The error logging here is good, but consider adding a more user-friendly message to the UI to inform the user that the taskbar lyric feature failed to initialize. This could be done via IPC to the main window.

Comment on lines +101 to +103
if (!success) {
processLog.error("[TaskbarLyric] 嵌入窗口失败");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a more descriptive error message to the UI if embedWindow fails. This will help the user understand why the taskbar lyric is not showing up.

Comment on lines +134 to +136
} catch (e) {
processLog.error("[TaskbarLyric] 更新布局失败", e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a more descriptive error message to the UI if updateLayout fails. This will help the user understand why the taskbar lyric is not showing up.

Comment on lines +157 to +159
} catch (e) {
processLog.error(e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a more descriptive error message to the UI if taskbarLyricNative.restore() fails. This will help the user understand why the taskbar lyric is not being properly restored.

Comment on lines +758 to +762
const taskbarLyrics = lyricData.yrcData.length > 0 ? lyricData.yrcData : lyricData.lrcData;
playerIpc.sendTaskbarLyrics({
lines: toRaw(taskbarLyrics),
type: lyricData.yrcData.length > 0 ? "word" : "line",
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a check to ensure taskbarLyrics is not null or empty before sending it via IPC. This will prevent potential errors if there are no lyrics to display.

    if (taskbarLyrics && taskbarLyrics.length > 0) {
      playerIpc.sendTaskbarLyrics({
        lines: toRaw(taskbarLyrics),
        type: lyricData.yrcData.length > 0 ? "word" : "line",
      });
    }

@apoint123 apoint123 marked this pull request as draft January 27, 2026 15:41
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.

1 participant