anthropics / anthropics/claude-code

Feature request: option to prevent the app window from stealing focus when a session needs attention

未关闭
#94,460 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:desktop enhancement platform:macos
主要语言
Python
星标
145k
派生
23.1k
PR 合并指标
PR 指标待抓取

描述

## Summary

When a running Claude Code session needs the user's attention (a permission prompt appears, or a task finishes and is waiting on input), the **desktop app window forcibly comes to the foreground and steals focus** from whatever other application the user is actively working in on macOS.

## Why this is disruptive

If the user is focused on unrelated work in another app (writing, browser, design tool, etc.) and a background Claude Code session — especially a long-running agentic task doing many tool calls — needs a permission decision, the app yanks the user's attention away immediately and interrupts whatever they were doing, rather than just signaling that attention is needed (sound, badge, banner) and letting the user switch over when ready.

This gets worse the more sessions/scheduled tasks a user runs in parallel, since each one needing attention can trigger an unwanted focus-steal at an arbitrary moment.

## What's already configurable (and why it doesn't fully solve this)

- `inputNeededNotifEnabled` — push notification when Claude is waiting on input
- `preferredNotifChannel` — choose between terminal bell or desktop notification for task completion

Switching `preferredNotifChannel` to `"terminal-bell"` avoids the OS notification banner, but does not appear to stop the app window itself from coming to the front — the foreground-steal seems to be separate, hardcoded behavior tied to "needs attention" state rather than to the notification channel setting.

## Requested behavior

Please add a setting (e.g. `stealFocusOnAttentionNeeded: false` in `settings.json`, or a toggle in the desktop app's Preferences) that lets the user opt out of the window being forced to the foreground when a session needs attention — while still surfacing *some* passive signal (dock badge, sound, system notification) so the user can switch over on their own terms instead of being interrupted mid-task in another app.

## Environment

- macOS (Darwin), Claude Code desktop app
- Affects any workflow running multiple parallel/background sessions or scheduled tasks that may need permission input at unpredictable times

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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