﻿---
title: "通知有三路：TUI 事件、notify 命令、钩子，关掉要关干净"
summary: "tui.notifications 可以是布尔或事件数组。顶层 notify 会另起一条外部命令。WSL 上关了 TUI 仍可能弹出 PowerShell Toast。"
category: config
level: intermediate
surfaces: [cli]
tags: ["notifications", "TUI", "notify"]
canonical: /tips/tui-notifications-filter/
---

# 通知有三路：TUI 事件、notify 命令、钩子，关掉要关干净

tui.notifications 可以是布尔或事件数组。顶层 notify 会另起一条外部命令。WSL 上关了 TUI 仍可能弹出 PowerShell Toast。

```toml
[tui]
notifications = ["agent-turn-complete", "approval-requested"]
notification_condition = "unfocused"   # 或 always
notification_method = "auto"           # auto | osc9 | bel
```

`true` 全开，`false` 关掉 TUI 通知。数组按事件过滤，官方样例还有 `plan-mode-prompt`。默认只在终端失焦时响。tmux 里 `osc9` 或 `bel` 比桌面弹窗稳。

另一条通道是顶层 `notify`：Codex 把 JSON 交给外部命令，和 `tui.notifications` 不是同一个开关。Stop 钩子里的 `notify-send` 也独立。企业环境要把三条都关掉：`tui.notifications = false`、不要设 `notify`、不要留会弹系统通知的 Stop 钩子。

WSL 里 TUI 通知可能走 `powershell.exe -EncodedCommand` 做 Windows Toast，会触发 EDR。只关 `tui.notifications` 不够时，再查用户/项目 config 和钩子。

## 来源

- [OpenAI · Config reference](https://learn.chatgpt.com/docs/config-file/config-reference)
- [OpenAI Community · WSL EDR toasts](https://community.openai.com/t/codex-cli-on-windows-wsl-triggers-edr-alert-due-to-powershell-encodedcommand-toast-notifications/1375803)
