Skip to content

fix: 主窗口按 Esc 也能关闭第二屏 - #3

Merged
BeetMan merged 2 commits into
mainfrom
fix/esc-close-output
Oct 30, 2026
Merged

BeetMan merged 2 commits into
mainfrom
fix/esc-close-output

Conversation

@BeetMan

@BeetMan BeetMan commented Oct 30, 2026

Copy link
Copy Markdown
Owner

问题

在 Mac 上开启第二屏输出后,按 Esc 退出不稳定。

原因

Esc 的效果取决于键盘焦点在哪个窗口:

  • 第二屏窗口获得焦点时,Esc 会关闭第二屏
  • 主窗口获得焦点时,Esc 只会暂停播放

打开第二屏后,程序会先聚焦第二屏、再把焦点交回主窗口,方便继续用快捷键控制。macOS 上这两次聚焦是异步的,最后落在哪个窗口不确定,所以 Esc 时灵时不灵。

修复

  • 开启第二屏时,在主窗口按 Esc 也会关闭第二屏,编辑稿件时同样生效,且不改变播放状态
  • 未开第二屏时,Esc 仍是暂停播放
  • 前端同步到 Electron 版,文档中 Esc 的说明同步更新

验证

  • 新增 Playwright 用例:主窗口 Esc 关闭第二屏、播放状态不变、关闭后 Esc 恢复为暂停、编辑框中 Esc 也能关闭;去掉修复后该用例失败
  • npm run check 通过
  • 在 Mac 上用外接显示器实测

🤖 Generated with Claude Code

BeetMan and others added 2 commits October 30, 2026 11:44
After opening the second screen, keyboard focus is handed back to the main
window, and on macOS which window ends up focused is not deterministic. Esc
only closed the output when the output window itself was focused; in the main
window it just paused playback, so exiting felt unreliable.

While the output is open, Esc in the main window (including the script editor)
now closes it without changing playback. With no output open, Esc still pauses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BeetMan
BeetMan merged commit b5ba2d3 into main Oct 30, 2026
7 checks passed
@BeetMan
BeetMan deleted the fix/esc-close-output branch October 30, 2026 18:50
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