-
Notifications
You must be signed in to change notification settings - Fork 1.1k
✨ feat: 实现基础的任务栏歌词 #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
✨ feat: 实现基础的任务栏歌词 #777
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
}| const tray = getMainTray(); | ||
| tray?.setTaskbarLyricShow(show); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } catch (e) { | ||
| processLog.error("[TaskbarLyric] 创建注册表监听器失败", e); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (!success) { | ||
| processLog.error("[TaskbarLyric] 嵌入窗口失败"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } catch (e) { | ||
| processLog.error("[TaskbarLyric] 更新布局失败", e); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } catch (e) { | ||
| processLog.error(e); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const taskbarLyrics = lyricData.yrcData.length > 0 ? lyricData.yrcData : lyricData.lrcData; | ||
| playerIpc.sendTaskbarLyrics({ | ||
| lines: toRaw(taskbarLyrics), | ||
| type: lyricData.yrcData.length > 0 ? "word" : "line", | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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",
});
}
添加了基础的任务栏歌词功能,歌词的动画效果是基本没有的,只是打好了基础,接下来可以直接写vue和ts代码,应该不用再写原生代码了