Skip to content

🐞fix(desktopLyrics/window): 修复 macOS 桌面歌词启动死锁;优化桌面歌词焦点夺取问题#897

Merged
imsyy merged 3 commits into
SPlayer-Dev:devfrom
Pissofdvpe:dev
Feb 20, 2026
Merged

🐞fix(desktopLyrics/window): 修复 macOS 桌面歌词启动死锁;优化桌面歌词焦点夺取问题#897
imsyy merged 3 commits into
SPlayer-Dev:devfrom
Pissofdvpe:dev

Conversation

@Pissofdvpe
Copy link
Copy Markdown
Contributor

  • 修复 macOS 桌面歌词启动时卡在“歌词加载中”的问题:
    • 修正 LyricManager.ts 中残留的旧 IPC 频道名 update-desktop-lyric-data 为 desktop-lyric:update-data,确保歌词未变场景下的状态正确同步。
  • 优化窗口焦点管理,解决启动时主窗口失去焦点导致本地快捷键失效的问题:
    • 修改 lyric-window.ts,在 ready-to-show 事件中改用 showInactive() 显示窗口,防止静默启动时抢占焦点。
    • 优化 ipc-lyric.ts 的切换显示逻辑,统一使用 showInactive(),并补全了窗口创建时的初始锁定状态应用逻辑。
    • 在 useInit.ts 初始化流程末尾增加延时聚焦主窗口的逻辑(win-show-main),确保程序启动后主窗口稳获最终焦点。

- 修复 macOS 桌面歌词启动时卡在“歌词加载中”的问题:
  - 修正 LyricManager.ts 中残留的旧 IPC 频道名 update-desktop-lyric-data 为 desktop-lyric:update-data,确保歌词未变场景下的状态正确同步。
- 优化窗口焦点管理,解决启动时主窗口失去焦点导致本地快捷键失效的问题:
  - 修改 lyric-window.ts,在 ready-to-show 事件中改用 showInactive() 显示窗口,防止静默启动时抢占焦点。
  - 优化 ipc-lyric.ts 的切换显示逻辑,统一使用 showInactive(),并补全了窗口创建时的初始锁定状态应用逻辑。
  - 在 useInit.ts 初始化流程末尾增加延时聚焦主窗口的逻辑(win-show-main),确保程序启动后主窗口稳获最终焦点。
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Pissofdvpe, 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!

此拉取请求旨在解决 macOS 上桌面歌词功能相关的两个主要问题:一是修复了桌面歌词启动时可能出现的“歌词加载中”卡死现象,通过修正 IPC 频道名确保歌词状态正确同步;二是改进了窗口焦点管理机制,防止桌面歌词窗口启动时抢占主窗口焦点,从而确保本地快捷键的正常使用。这些改动提升了用户体验和应用的稳定性。

Highlights

  • macOS 桌面歌词启动死锁修复: 修复了 macOS 桌面歌词启动时卡在“歌词加载中”的问题,通过修正 IPC 频道名确保歌词状态正确同步。
  • 桌面歌词焦点管理优化: 优化了窗口焦点管理,解决了启动时主窗口失去焦点导致本地快捷键失效的问题,确保主窗口最终获得焦点。
Changelog
  • electron/main/ipc/ipc-lyric.ts
    • 将歌词窗口的显示方式从 show() 改为 showInactive(),避免抢占焦点。
    • 新增了根据 isLocked 状态设置歌词窗口忽略鼠标事件的逻辑,以应用初始锁定状态。
  • electron/main/windows/lyric-window.ts
    • ready-to-show 事件中,将歌词窗口的显示方法从 show() 更改为 showInactive(),以非活动状态显示。
  • src/composables/useInit.ts
    • 在初始化流程末尾添加了一个 500 毫秒的延迟,以发送 win-show-main IPC 消息,确保主窗口最终获得焦点。
  • src/core/player/LyricManager.ts
    • 更新了用于桌面歌词数据更新的 IPC 频道名称,从旧的 update-desktop-lyric-data 修正为 desktop-lyric:update-data
Activity
  • 目前没有人工活动。
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
Copy Markdown
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

本次代码变更修复了 macOS 桌面歌词的启动死锁问题,并优化了窗口焦点管理。整体来看,代码修改方向正确,逻辑清晰。

主要改进包括:

  • LyricManager.ts 中修正了错误的 IPC 频道名称,解决了状态同步的 bug。
  • ipc-lyric.tslyric-window.ts 中统一使用 showInactive() 来显示歌词窗口,有效避免了启动时抢占焦点的问题。
  • ipc-lyric.ts 中补充了窗口创建时的初始锁定状态,增强了逻辑的完整性。

有一点可以改进:在 useInit.ts 中使用了 setTimeout 来确保主窗口最后获得焦点。虽然这是一种常见的解决方案,但其可靠性依赖于固定的延迟时间,可能存在潜在的竞态条件。

总体而言,这是一次高质量的修复和优化。

Comment thread src/composables/useInit.ts Outdated
Pissofdvpe and others added 2 commits February 18, 2026 12:15
- 在 useInit.ts 初始化流程末尾增加基于 FINAL_FOCUS_DELAY_MS 常量的延时聚焦逻辑(win-show-main),并仅在桌面歌词开启时触发,确保程序启动后主窗口稳获最终焦点,同时提升代码可维护性。
@imsyy imsyy merged commit 71a5215 into SPlayer-Dev:dev Feb 20, 2026
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