Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动类型
是否包含破坏性变更
改动说明
原生 Wayland 下,灵动岛随歌词改变窗口宽度时,Electron 无法自行设置窗口的全局位置。在 Niri 中可复现左边缘不动、窗口中心随宽度偏移:窗口宽度从 255 变为 711 时,中心横向移动了 228 个逻辑像素。
新增可选的
scripts/niri-island-center.mjs,通过 Niri IPC 订阅窗口事件,将灵动岛保持在所属显示器的水平中心,同时保留宽高、纵向位置和原有鼠标区域。只匹配 SPlayer 的Dynamic Island浮动窗口;普通窗口和其他应用不受影响。无需额外 npm 依赖,也不使用定时轮询或外部命令。Niri 26.04 会为超过 10 个逻辑像素的浮动窗口移动添加动画,因此将修正拆为同一连接上的连续小步移动,避免换行时叠加额外的移动动画。重入事件会合并处理;缺失布局信息时跳过,连接或协议错误时退出并释放资源。
补充中英文安装、登录启动、卸载和兼容性说明,并提供可单独运行的回归测试。本修复由 Niri 用户主动启用,不改播放器默认行为,不改 Windows、macOS 或 KDE 的窗口实现。
关联 Issue
Related to #75、#223。
#223 包含 Linux 窗口形状处理和 KWin 居中方案;本 PR 补充 Niri 下的水平居中,不替代其实现,也不解决 #75 中的置顶或鼠标穿透问题。
测试情况
pnpm test:35 项 Node 测试、27 个文件中的 195 项 Vitest 测试通过。pnpm typecheck、pnpm lint、全仓 Prettier 检查及git diff --check通过;lint 有player.spec.ts中既有的 2 条组件数量警告,无错误。兼容性边界:10 像素动画阈值属于 Niri 实现细节,已在 26.04 验证,未来升级需复验。横向拖动会重新居中,纵向拖动保留。Windows/macOS 未进行实机回归,本 PR 的辅助脚本只由 Niri 用户显式运行。
自查清单