﻿---
title: "桌面 Open in 用 desktop.custom_file_handlers，不要写进项目配置"
summary: "只认用户级 ~/.codex/config.toml。给 VSCodium、TextEdit 或内部编辑器加目标后，必须重启 ChatGPT 桌面应用。CLI 的 file_opener 管的是另一套。"
category: config
level: intermediate
surfaces: [app]
tags: ["desktop", "config.toml", "编辑器"]
canonical: /tips/desktop-custom-file-handlers/
---

# 桌面 Open in 用 desktop.custom_file_handlers，不要写进项目配置

只认用户级 ~/.codex/config.toml。给 VSCodium、TextEdit 或内部编辑器加目标后，必须重启 ChatGPT 桌面应用。CLI 的 file_opener 管的是另一套。

项目 `.codex/config.toml` 里写这个键会被忽略。handler ID 是表头最后一段：1–64 字符，以字母或数字开头；含句点时要加引号，否则 TOML 会当成嵌套表。界面里会变成 `custom:id`。

```toml
[desktop.custom_file_handlers.vscodium]
label = "VSCodium"
icon = "/Users/you/.codex/icons/vscodium.png"
command = "codium"

[desktop.custom_file_handlers.textedit]
label = "TextEdit"
icon = "/Users/you/.codex/icons/textedit.png"
command = "/usr/bin/open"
args = ["-a", "TextEdit"]
```

`label` / `icon` / `command` 必填。`command` 必须是绝对路径，或能在桌面应用的 PATH 里找到。`input` 默认 `path`；需要行号用 `json_argument`；SSH 工作区用 `supports_ssh = true` 且 `input = "json_stdin"`。改完重启桌面应用。设成首选编辑器后，会按项目记住，和内置编辑器一样。

## 来源

- [OpenAI · Advanced configuration](https://learn.chatgpt.com/docs/config-file/config-advanced)
