Skip to content

ui: align Codex++ injected UI with Codex appearance#907

Open
wangbax wants to merge 3 commits into
BigPizzaV3:mainfrom
wangbax:codex/ui-polish-main
Open

ui: align Codex++ injected UI with Codex appearance#907
wangbax wants to merge 3 commits into
BigPizzaV3:mainfrom
wangbax:codex/ui-polish-main

Conversation

@wangbax

@wangbax wangbax commented Jun 12, 2026

Copy link
Copy Markdown

需求背景

这轮改动来自 Codex++ 注入 UI 在新版 Codex 桌面端中的一组视觉和交互回归反馈。Codex++ 的顶部入口、设置弹框、侧边栏会话操作、Upstream worktree 弹框和后端状态展示都注入在 Codex 原生页面上,因此它们需要跟随 Codex 当前的 Appearance、语言、菜单层级和原生控件状态,而不是维护一套独立的暗色、透明度和自定义控件风格。

本次排查过程中主要聚焦这些问题:

  • 顶部原生 menu 区域有预览/切换状态时,Codex++ 1.2.x 按钮空间被挤压,填充态和边框态在不同窗口状态下不统一。
  • 设置页、启动 loading 等非主会话界面不应该出现 Codex++ 顶部入口。
  • 打开或关闭 Codex++ 弹框时,后端连接状态会先显示红色/检测中,再变为绿色,造成已连接但闪断的观感。
  • 弹框一直偏黑、带透明感,并且单选框、开关、选择框、按钮等没有复用 Codex Settings / Appearance 的 token。
  • 暗色模式下页面像被额外蒙了一层遮罩,导致按钮和内容显得偏灰。
  • 默认英文环境下仍有部分中文文案;用户切换中文/英文时,Codex++ 应跟随 Codex 的语言逻辑,而不是额外维护独立语言筛选。
  • 侧边栏会话 item 的删除和 More actions 图标、hover、tooltip、弹出菜单风格与 Codex 原生 Archive Chat / 标题更多菜单不一致。
  • Upstream worktree 的二级弹框层级和输入框宽度需要和 Codex 原生弹框对齐。
  • 弹框缺少 Escape 关闭能力。
  • CDP target 在 avatar overlay 窗口存在时可能选错页面,进而影响注入和状态刷新稳定性。

方案说明

1. 统一注入 UI 的 Codex token 体系

Codex++ 弹框、菜单、按钮、输入框、选择框、radio / switch 状态统一改为 CSS token 驱动,优先读取 Codex 当前页面暴露的颜色变量,例如菜单背景、输入框背景、边框、foreground、accent、focus border 和 button token。

本次特别收敛了这些控件:

  • Page enhancements 等开关改成 Codex 原生 switch 结构:32x20 track、16x16 knob,unchecked 使用 foreground/10,checked 使用 Codex accent / charts blue,knob 使用 gray-0。
  • Open manager、Open DevTools、社区入口等普通 action button 使用 Codex 原生按钮的 foreground/5 默认背景和 foreground/10 hover 背景,但字号和 padding 保持 Codex++ 弹框内的紧凑尺寸,避免按钮变大。
  • 弹框按钮、输入框、选择框、tab、状态 chip、focus ring 都走 Codex token fallback,不再硬编码一套暗色主题。

2. 顶部 Codex++ 菜单入口更稳定

顶部 Codex++ 版本入口保留在 Codex 原生顶部 menu 区域,并收敛为和 Codex 原生菜单协调的 outline chip:

  • 不使用填充色,避免和原生菜单抢视觉重心。
  • 高度恢复到较舒适尺寸,避免顶部预览态挤压后显得过矮。
  • border、hover、foreground 都使用 Codex button / menu token。
  • 等待 Codex header actions 就绪后再挂载,避免启动 loading 阶段提前显示。
  • 设置页检测到 Back to app / General / Appearance 等原生导航后会移除入口,避免设置页出现 Codex++ 菜单。
  • 显示版本来自构建注入的 CODEX_PLUS_VERSION,会随构建版本变化。

3. 后端连接状态改为缓存展示,避免开关弹框闪红

后端仍然按 heartbeat 检测,但弹框打开/关闭时不再把展示态立即重置为 checking / disconnected。

新增展示层逻辑:

  • 最近 12 秒内有成功 heartbeat 时,弹框继续展示 connected。
  • 失败次数不足阈值时不急着切到 Not connected。
  • Backend connection 的显示文案根据 status 生成,不再直接依赖后端 message,因此不会因为后端返回中文未连接而污染英文界面。
  • Backend connected 收敛为更短的 connected。

最终效果是:已连接状态下反复打开/关闭 Codex++ 弹框,不会先出现红色未连接再跳绿色。

4. 语言跟随 Codex,默认英文并保留中文切换

补齐注入 UI 的英文文案,默认英文界面显示英文;切到中文后显示中文,再切回英文也会恢复英文。

实现上不新增 Codex++ 独立语言下拉,而是读取 Codex 当前可见原生 UI 的语言信号:

  • 优先使用运行时语言 hint。
  • 再根据可见原生按钮、导航、placeholder、aria-label 等内容评分识别英文/中文。
  • 忽略 Codex++ 自己注入的节点,避免菜单内容反过来污染语言判断。
  • 最后才回退到已存储语言,默认英文。

补齐/修正的文案包括:

  • Backend connection 状态:connected / Not connected
  • More actions、Delete、Export、Move、Remove from project
  • project move 弹框标题、loading、empty、失败提示
  • Not needed 等短标签避免窄区域不必要换行

5. 弹框和控件贴近 Codex Settings

设置弹框最终表现为:

  • 背景不透明,颜色跟随 Codex 当前 Appearance。
  • overlay 背景改为透明,不再给整个 Codex 页面叠额外蒙版,避免暗色模式下内容和按钮显得 disabled / 偏灰。
  • radio / switch 开启态使用 Codex accent,指示色使用白色 / gray-0,贴近 Codex Settings 的 Permissions - Default permissions 控件。
  • 选择框、输入框、分段 tab、底部按钮使用 Codex token,避免白底黑字或独立暗色主题混用。
  • 弹框支持 Escape 关闭;有 Upstream worktree、删除确认、移动项目等二级弹框在顶层时,不会误关底层主弹框。

6. 侧边栏会话操作改成 Codex 原生风格

会话 item 右侧操作区改为更接近 Codex 原生 Archive Chat / More menu:

  • 删除和更多按钮使用 20x20 icon button,透明底,hover / active 状态跟随 Codex。
  • 使用图标和 tooltip,不再使用突兀的文字按钮或三点文本。
  • More actions 弹框缩窄为紧凑菜单,实体背景不透明,样式接近标题更多菜单。
  • 菜单项支持 Export、Move、Delete 的英文/中文文案,并使用对应 icon。
  • 从会话标题提取逻辑里剥离英文 action 文案,避免标题被 Export / Delete / Move 等按钮文本污染。

7. Upstream worktree 和 CDP 稳定性补强

这次还补了几处和 UI 稳定性相关的底层行为:

  • Upstream worktree 的二级弹框现在显示在最上层,输入框不会超过背景容器。
  • Upstream worktree 弹框支持 Escape 关闭,并在重复打开时清理旧 keydown listener。
  • CDP 页面选择会优先主 Codex 页面,avatar overlay 页面会排在后面,降低注入错页和状态异常概率。
  • helper 端口 bind 失败时,如果已有 helper 的 /backend/status 正常返回,会复用现有 helper,减少重复启动/端口占用造成的异常。
  • macOS 通过 open 激活已安装 Codex app 时,会等待 Codex app 退出,避免 launcher 生命周期提前结束。

8. PR 范围收敛

这次 rebase 到最新 origin/main 后,移除了无关的 bridge binding diff:

  • BRIDGE_BINDING_NAME 保持上游当前的 codexSessionDeleteV2,不在本 PR 里升级到 V3。
  • codexDeleteStyleVersion 保持为 14,避免为了这轮 UI 修复引入过大的样式版本跳跃。
  • PR 文件列表收敛为注入 UI、CDP target、launcher 行为和对应测试,不包含 README 图片、二维码或发布资源改动。

最终 UI 展现

顶部菜单入口

顶部 Codex++ 1.2.x 入口现在是和 Codex 原生菜单协调的 outline 按钮,尺寸稳定,不会因为顶部 menu 预览态显得被压扁。

Codex++ top menu outline button

Codex++ 设置弹框

点击顶部入口打开的 Codex++ 弹框会跟随 Codex 日/夜间和 accent 配色,不再固定黑色,也没有透明面板感。Backend connection 已连接时显示 connected,Page enhancements 等开关使用 Codex accent + 白色指示;插件相关按钮使用 Codex 原生按钮色值,并避免 Not needed 换行。

Codex++ settings modal aligned with Codex appearance

侧边栏 More actions

侧边栏会话 item 的删除和 More actions 与 Codex 原生 Archive Chat / 更多菜单一致,hover、icon、tooltip 和弹出菜单都更贴近原生体验。More actions 菜单更短、更紧凑,背景色是实色菜单背景,不再显得过宽或透明。

Codex++ sidebar More actions menu

补充效果:

  • 英文 Codex 下默认显示英文;切到中文后显示中文,再切回英文也会恢复英文。
  • 设置页和启动 loading 阶段不会展示 Codex++ 顶部入口。
  • 弹框支持 Escape 关闭。
  • 暗色模式下不会给整个 Codex 页面额外叠一层灰蒙版。
  • Upstream worktree 的二级弹框会浮在最上层,输入框不会超过背景容器。

影响范围

  • 主要影响 assets/inject/renderer-inject.js 的注入 UI、文案、状态展示和菜单行为。
  • codex-plus-core 增加 CDP target 选择、helper 复用和 launcher 等待逻辑。
  • 更新 cdp_bridge 测试覆盖注入脚本的 token、语言、菜单按钮、后端状态缓存、Esc 关闭、project move 本地化、Upstream worktree 弹框和 avatar overlay target 选择。
  • 不包含 README 图片、二维码或发布版本文件改动;本分支已基于最新 origin/main。
  • 截图托管在 fork 的 pr-assets/907 辅助分支,仅用于 PR 描述展示,不进入本 PR 的代码 diff。

验证

  • node --check assets/inject/renderer-inject.js
  • cargo test -p codex-plus-core --test cdp_bridge
  • ./node_modules/.bin/vite build
  • cargo build -p codex-plus-launcher -p codex-plus-manager --release --target aarch64-apple-darwin

备注

release build 已通过,目前仅保留 main 上已有的 warning:Windows uninstall 常量未使用、Windows proxy parser 未使用,以及一个 unused_mut warning。

@wangbax wangbax changed the title fix: polish Codex++ injected UI interactions ui: align Codex++ injected UI with Codex appearance Jun 12, 2026
@wangbax wangbax force-pushed the codex/ui-polish-main branch 2 times, most recently from 0978cff to 87f5668 Compare June 12, 2026 13:42
@BigPizzaV3

Copy link
Copy Markdown
Owner
  1. 没有中文
  2. 深色下蒙版有问题

@wangbax wangbax force-pushed the codex/ui-polish-main branch 2 times, most recently from f1e2c48 to 356d0d5 Compare June 16, 2026 03:27
@wangbax

wangbax commented Jun 16, 2026

Copy link
Copy Markdown
Author

@BigPizzaV3 这轮已经基于最新 origin/main 重新 rebase,并补充/收敛了后续反馈里的修复点,可以继续 review 了。

主要新增和调整:

  • 设置页和启动 loading 阶段不再展示顶部 Codex++ 入口,入口会等 Codex header actions 就绪后再挂载。
  • Codex++ 弹框支持 Esc 关闭;有 Upstream worktree / 删除确认 / 移动项目等二级弹框时不会误关底层弹框。
  • 后端连接状态增加展示缓存,已连接时打开/关闭弹框不会先闪红再变绿;Backend connection 状态文案也不再直接透传后端中文 message。
  • 语言逻辑改为跟随 Codex 可见原生 UI,默认英文,切中文后弹框会同步中文,再切回英文也会恢复英文。
  • 暗色模式下去掉额外 overlay 蒙版,避免整个 Codex 页面和按钮看起来像 disabled。
  • Page enhancements 等 switch 对齐 Codex 原生 switch 结构和色值;Open manager / Open DevTools 等按钮使用 Codex 原生 foreground/5、foreground/10 色值,但保持弹框内紧凑字号。
  • 侧边栏删除和 More actions 的 icon、tooltip、hover、菜单背景和宽度更贴近 Codex 原生 Archive Chat / 标题更多菜单,并补齐英文文案。
  • Upstream worktree 二级弹框层级修复,输入框不再超过背景容器,也支持 Esc 清理。
  • CDP target 选择优先主 Codex 页面,避免 avatar overlay 被误选导致注入错页。
  • PR 范围也做了收敛:BRIDGE_BINDING_NAME 保持 codexSessionDeleteV2codexDeleteStyleVersion 保持 14,无关的 bridge.rs diff 已移除。

验证已过:

  • node --check assets/inject/renderer-inject.js
  • cargo test -p codex-plus-core --test cdp_bridge
  • git diff --check

PR 描述也已经同步更新了需求背景、方案说明和最终 UI 展现。

wangbax and others added 3 commits June 17, 2026 11:12
Refine the injected Codex++ menu, modal, sidebar action controls, and localized labels so they track Codex appearance and language behavior more closely.

Cache backend status during menu open/close to avoid transient disconnected flashes, improve CDP target selection around avatar overlays, and keep the launcher waiting for packaged Codex app exits.

Tests: node --check assets/inject/renderer-inject.js; cargo test -p codex-plus-core --test cdp_bridge; ./node_modules/.bin/vite build; cargo build -p codex-plus-launcher -p codex-plus-manager --release --target aarch64-apple-darwin.

Generated-By: Codex (GPT-5)
Co-authored-by: Codex <codex@openai.com>
Align the Codex++ modal, menu trigger, sidebar actions, language detection, and native-control styling with Codex appearance behavior.

Keep the bridge binding scoped to the existing V2 contract while improving CDP page-target selection and covering the injected UI behavior with tests.

Generated-By: Codex (GPT-5)

Co-authored-by: Codex <codex@openai.com>
Keep an explicit Codex++ manager theme preference when present, but fall back to the system color scheme on first launch instead of writing dark mode unconditionally.

Generated-By: Codex (GPT-5)

Co-authored-by: Codex <codex@openai.com>
@wangbax wangbax force-pushed the codex/ui-polish-main branch from 356d0d5 to 2a27578 Compare June 17, 2026 03:19
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.

2 participants