配置

cmux 从 Ghostty 配置文件中读取配置,如果你之前使用 Ghostty,这些选项会很熟悉。

配置文件位置

cmux 按以下顺序查找配置:

  1. ~/.config/ghostty/config
  2. ~/Library/Application Support/com.mitchellh.ghostty/config

如果配置文件不存在,请创建:

mkdir -p ~/.config/ghostty
touch ~/.config/ghostty/config

外观

字体

~/.config/ghostty/config
font-family = JetBrains Mono
font-size = 14

颜色

~/.config/ghostty/config
# Theme (or use individual colors below)
theme = Dracula

# Custom colors
background = #1e1e2e
foreground = #cdd6f4
cursor-color = #f5e0dc
cursor-text = #1e1e2e
selection-background = #585b70
selection-foreground = #cdd6f4

分屏面板

~/.config/ghostty/config
# Opacity for unfocused splits (0.0 to 1.0)
unfocused-split-opacity = 0.7

# Fill color for unfocused splits
unfocused-split-fill = #1e1e2e

# Divider color between splits
split-divider-color = #45475a

行为

回滚缓冲区

~/.config/ghostty/config
# Number of lines to keep in scrollback buffer
scrollback-limit = 10000

工作目录

~/.config/ghostty/config
# Default directory for new terminals
working-directory = ~/Projects

应用设置

应用内设置可通过 cmux > Settings(⌘,)打开:

主题模式

  • System:跟随 macOS 外观
  • Light:始终使用浅色模式
  • Dark:始终使用深色模式

自动化模式

控制 socket 访问级别:

  • Off:禁用 socket 控制(最安全)
  • cmux processes only:仅允许在 cmux 终端内启动的进程连接
  • allowAll:允许任何本地进程连接(CMUX_SOCKET_MODE=allowAll,仅通过环境变量覆盖)
在共享机器上,建议使用「Off」或「cmux processes only」模式。

浏览器链接行为

在 Settings > Browser 中,cmux 提供两个用途不同的主机列表:

  • 在内嵌浏览器中打开的主机:适用于从终端输出点击的链接。此列表中的主机在 cmux 中打开;其他主机在默认浏览器中打开。支持单个主机或通配符,每行一个(例如:example.com、*.internal.example)。
  • 内嵌浏览器允许的 HTTP 主机:仅适用于 HTTP(非 HTTPS)URL。此列表中的主机可以在 cmux 中打开而不显示警告提示。默认包括 localhost、127.0.0.1、::1、0.0.0.0 和 *.localtest.me。

配置示例

~/.config/ghostty/config
# Font
font-family = SF Mono
font-size = 13

# Colors
theme = One Dark

# Scrollback
scrollback-limit = 50000

# Splits
unfocused-split-opacity = 0.85
split-divider-color = #3e4451

# Working directory
working-directory = ~/code