github / github/copilot-cli

Desktop notifications suppressed when terminal window is backgrounded but the Copilot tab stays active (macOS)

未关闭
#4,036 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:terminal-rendering
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

### Version
1.0.66+ (notification feature introduced in 1.0.66)

### Summary
Desktop notifications (attention / idle, added in 1.0.66) do not fire when the
terminal window is in the background but the Copilot session's tab remains the
active tab within that window. Notifications work correctly when switching to a
different tab or a fully separate app.

### Root cause (from the shipped bundle)
Notification firing is gated on terminal focus tracked via DEC private mode 1004:
- CLI sends `ESC[?1004h`; FocusIn (`ESC[I`) sets focused=true, FocusOut (`ESC[O`) sets focused=false.
- Both the attention and idle paths only notify when `focused !== true`.

When a window is backgrounded while its active tab is unchanged, many terminals
(and tmux/control-mode setups) do not deliver a FocusOut to the active tab's PTY.
`focused` therefore stays `true` and the notification is silently dropped. The CLI
relies solely on DEC-1004 with no fallback, and there is no setting/env to override
the focus gate (only COPILOT_DISABLE_DESKTOP_NOTIFICATIONS to turn them off).

### Repro
1. Open Copilot CLI in a tab; keep it the active tab in its window.
2. Click another window/app so the terminal window loses focus (do NOT switch tabs).
3. Trigger an attention/idle notification (e.g. let a task finish / wait for input).
4. Expected: desktop notification. Actual: none.

### Environment
- OS: macOS
- Terminal:
- Multiplexer:

### Suggested fix
Either (a) add a fallback / periodic focus re-query so stale `focused=true` doesn't
suppress notifications, or (b) add an opt-in setting/env (e.g. `notifyWhenFocused` /
`COPILOT_ALWAYS_NOTIFY`) to bypass the focus gate.

### Affected version

1.0.66+

### Steps to reproduce the behavior

1. Open Copilot CLI in a tab; keep it the active tab in its window.
2. Click another window/app so the terminal window loses focus (do NOT switch tabs).
3. Trigger an attention/idle notification (e.g. let a task finish / wait for input).
4. Expected: desktop notification. Actual: none.

### Expected behavior

notification popup on macOs should still come in.

### Additional context

_No response_

贡献指南

打开贡献指南

调研方向

Start by tracing DEC private mode 1004 focus tracking in the shipped bundle, then inspect the attention and idle notification paths that require focused !== true. Reproduce the macOS background-window case with the active tab unchanged. Done means notifications appear when the terminal window loses focus, while existing tab-switch behavior and the disable-notifications setting still work.

由索引模型根据 Issue 内容生成。

评估

技术栈
macos, shell
领域
cli, desktop-dev, operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。