A Python script that creates lightweight .app wrappers for Electron-based macOS(Intel) applications (e.g. Codex, Claude), injecting Chromium flags to fix UI rendering issues and improve performance.
Codex and Claude desktop apps on macOS may exhibit:
UI Display Issues:
- Text rendering artifacts or blurry fonts
- UI elements not displaying correctly (missing buttons, broken layouts)
- Visual glitches during window resizing
- Incorrect color rendering or transparency issues
Performance Issues:
- Laggy or janky UI animations
- High CPU usage during scrolling or window resizing
- Sluggish text rendering in chat interfaces
- GPU not being fully utilized (falling back to software rendering)
These issues stem from Electron/Chromium's default rendering settings not being optimized for macOS, particularly on Macs with multiple GPUs or high-DPI displays.
This script creates a standalone wrapper app (e.g. Codex Pro.app) that launches the original app with the following Chromium flags:
| Flag | Effect |
|---|---|
--force-prefers-reduced-motion |
Reduces unnecessary CSS animations, lowering CPU/GPU load |
--force_high_performance_gpu |
Forces the discrete GPU on dual-GPU Macs |
--enable-gpu-rasterization |
Offloads page rasterization to GPU instead of CPU |
The wrapper is a separate .app — it does not modify the original application, so updates won't break anything.
python3 create_electron_wrapper.py <AppName>Examples:
python3 create_electron_wrapper.py Codex
python3 create_electron_wrapper.py Claude
python3 create_electron_wrapper.py CursorThis creates /Applications/<AppName> Pro.app. Drag it to your Dock and use it instead of the original icon.
- macOS
- Python 3.6+
- Target app installed in
/Applications/
一个 Python 脚本,为 macOS (intel芯片) 上的 Electron 应用(如 Codex、Claude)创建轻量 .app wrapper,注入 Chromium 启动参数以修复 UI 渲染问题并提升性能。
Codex 和 Claude 桌面应用在 macOS 上可能出现:
UI 显示异常:
- 文字渲染异常或字体模糊
- UI 元素显示不正确(按钮缺失、布局错乱)
- 调整窗口大小时出现视觉闪烁
- 颜色渲染或透明度异常
性能问题:
- UI 动画卡顿
- 滚动或调整窗口大小时 CPU 占用过高
- 聊天界面文字渲染迟缓
- GPU 未被充分利用(回退到软件渲染)
根本原因是 Electron/Chromium 的默认渲染配置未针对 macOS 优化,在多 GPU 或高分辨率屏幕的 Mac 上尤为明显。
脚本会创建一个独立的 wrapper 应用(如 Codex Pro.app),在启动原应用时自动注入以下 Chromium 参数:
| 参数 | 作用 |
|---|---|
--force-prefers-reduced-motion |
减少不必要的 CSS 动画,降低 CPU/GPU 负载 |
--force_high_performance_gpu |
在双 GPU 的 Mac 上强制使用独立显卡 |
--enable-gpu-rasterization |
将页面光栅化从 CPU 转移到 GPU |
Wrapper 是独立的 .app,不会修改原应用,应用更新不受影响。
python3 create_electron_wrapper.py <应用名称>示例:
python3 create_electron_wrapper.py Codex
python3 create_electron_wrapper.py Claude
python3 create_electron_wrapper.py Cursor生成的 /Applications/<应用名> Pro.app 拖到 Dock 上即可使用。
- macOS
- Python 3.6+
- 目标应用已安装在
/Applications/