Skip to content

✨ feat: 实现基础的任务栏歌词#777

Merged
kazukokawagawa merged 2 commits intoimsyy:devfrom
apoint123:feat/taskbar-lyric
Feb 1, 2026
Merged

✨ feat: 实现基础的任务栏歌词#777
kazukokawagawa merged 2 commits intoimsyy:devfrom
apoint123:feat/taskbar-lyric

Conversation

@apoint123
Copy link
Collaborator

@apoint123 apoint123 commented Jan 27, 2026

添加了任务栏歌词功能

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

@apoint123 apoint123 marked this pull request as draft January 27, 2026 15:41
@apoint123 apoint123 force-pushed the feat/taskbar-lyric branch 6 times, most recently from e3cfe83 to 37ba6be Compare January 31, 2026 19:19
@apoint123 apoint123 marked this pull request as ready for review February 1, 2026 07:53
@apoint123
Copy link
Collaborator Author

/gemini review

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

这次的 PR 实现了任务栏歌词功能,这是一个很棒的新特性。实现非常全面,对 Windows 10 和 Windows 11 采用了不同的策略,令人印象深刻。代码结构清晰,原生代码、主进程逻辑和渲染进程 UI 之间的分离做得很好。我提出了一些改进建议,主要涉及代码重复和潜在的可维护性问题。总的来说,这是一次高质量的贡献。

@apoint123 apoint123 requested a review from imsyy February 1, 2026 11:17
@kazukokawagawa kazukokawagawa merged commit bba31eb into imsyy:dev Feb 1, 2026
@apoint123 apoint123 deleted the feat/taskbar-lyric branch February 1, 2026 15:03
@apoint123
Copy link
Collaborator Author

/gemini review

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 'Taskbar Lyric' feature, allowing lyrics to be displayed directly on the Windows taskbar. This involves adding two new native Rust modules, taskbar-lyric and tools, to the project workspace and build process. The taskbar-lyric module handles embedding the lyric window into the taskbar, dynamically adjusting its layout based on Windows 10 or 11 taskbar configurations, and monitoring taskbar changes via registry, UI Automation (UIA), and tray events. The tools module provides a utility to detect Explorer restarts. The Electron main process now manages the lifecycle of the taskbar lyric window, including creating/closing it, updating its content (metadata, lyrics, progress, playback state), and responding to taskbar layout changes and Explorer restarts. A new IPC channel taskbar: is established for communication between the renderer and main processes for this feature. The tray menu is updated with an option to toggle taskbar lyrics, and the application's store now persists the enabled state of this feature. The renderer process includes new Vue components for rendering the taskbar lyrics with animations and media controls. Review comments suggest refactoring several magic numbers into named constants for improved readability and maintainability, and ensuring consistent import type usage for type-only imports.

Comment on lines +67 to +69
setTimeout(() => {
taskbarLyricWindow.create();
}, 500);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这里的 500 是一个魔法数字。建议将其定义为一个常量,并添加注释说明其用途,例如等待 Explorer 重启后完全准备就绪。这会使代码更易于理解和维护。

例如:

const EXPLORER_RESTART_DEBOUNCE_MS = 500;

// ...

setTimeout(() => {
  taskbarLyricWindow.create();
}, EXPLORER_RESTART_DEBOUNCE_MS);

Comment on lines +203 to +205
const GAP = 10 * scaleFactor;
const MAX_WIDTH_PHYSICAL = 300 * scaleFactor;
const MIN_WIDTH_PHYSICAL = 50 * scaleFactor;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这里的 1030050 都是用于布局计算的魔法数字。建议将它们定义为类顶部的常量,例如 PHYSICAL_GAPMAX_LYRIC_WIDTH_PHYSICALMIN_LYRIC_WIDTH_PHYSICAL。这样做可以提高代码的可读性和可维护性。此外,300 这个值在 updateLayout 方法中也被使用,提取为常量可以确保一致性。

Comment on lines +414 to +418
setTimeout(() => {
if (winToClose && !winToClose.isDestroyed()) {
winToClose.close();
}
}, 350);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这里的 350ms 延迟是一个魔法数字。它应该与 CSS 中的淡出动画时长保持一致。更好的做法是将其定义为一个常量,并在 CSS 和 TypeScript 代码中同时使用,以确保同步。

Comment on lines +2 to +6
import type { PlayModePayload, RepeatModeType, ShuffleModeType } from "@/types/shared";
import { isElectron } from "@/utils/env";
import { getPlaySongData } from "@/utils/format";
import { DiscordConfigPayload, MetadataParam, PlaybackStatus, RepeatMode } from "@emi";
import type { LyricLine } from "@applemusic-like-lyrics/lyric";
import type { DiscordConfigPayload, MetadataParam, PlaybackStatus, RepeatMode } from "@emi";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

为了保持代码风格一致,建议对所有仅用于类型的导入使用 import type

import type { PlayModePayload, RepeatModeType, ShuffleModeType } from "@/types/shared";
import { isElectron } => "@/utils/env";
import { getPlaySongData } => "@/utils/format";
import type { LyricLine } } from "@applemusic-like-lyrics/lyric";
import type { DiscordConfigPayload, MetadataParam, PlaybackStatus, RepeatMode } } from "@emi";

const updateLyric = () => {
if (state.lyrics.length) {
// 提前 0.4s 以便让歌词进场动画跑完
const firstLineCompensation = state.lyricIndex === -1 ? 400 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这里的 400 是一个魔法数字。建议将其定义为一个常量,并添加一个有意义的名称,例如 FIRST_LINE_ANIMATION_COMPENSATION_MS,以提高代码的可读性。

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.

3 participants