From d82c9af6503f985da1768c48a0c1fbcc09824b37 Mon Sep 17 00:00:00 2001 From: laily Date: Sun, 24 May 2026 14:14:38 +0800 Subject: [PATCH] feat: add ghostty --- ghostty/{config => config.ghostty} | 12 ++++++++++++ script/ghostty-init.sh | 12 ++++++++++-- tmux/.tmux.conf | 12 ++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) rename ghostty/{config => config.ghostty} (80%) diff --git a/ghostty/config b/ghostty/config.ghostty similarity index 80% rename from ghostty/config rename to ghostty/config.ghostty index 4824675..99312f2 100644 --- a/ghostty/config +++ b/ghostty/config.ghostty @@ -35,3 +35,15 @@ cursor-style-blink = true # 滚动条设置:通常建议隐藏,通过 Tmux 控制滚动 mouse-scroll-multiplier = 1 scrollback-limit = 10000 + +# Ghostty 配置 +desktop-notifications = true + +#term = xterm-256color + +scrollbar = system +mouse-shift-capture = true + +shell-integration-features = ssh-env,ssh-terminfo +# 开启所有 shell 集成特性,包含 ssh-terminfo 自动注入 +shell-integration = fish diff --git a/script/ghostty-init.sh b/script/ghostty-init.sh index 614dbdf..00984b7 100755 --- a/script/ghostty-init.sh +++ b/script/ghostty-init.sh @@ -7,10 +7,18 @@ YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' -SRC="$HOME/.dotfile/ghostty/config" -DEST="$HOME/.config/ghostty/config" +SRC="$HOME/.dotfile/ghostty/config.ghostty" + +# 根据平台确定目标路径 +if [[ "$(uname)" == "Darwin" ]]; then + DEST="$HOME/Library/Application Support/com.mitchellh.ghostty/config.ghostty" +else + CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" + DEST="$CONFIG_HOME/ghostty/config.ghostty" +fi echo -e "${YELLOW}初始化 Ghostty 配置...${NC}" +echo -e "${YELLOW}目标路径:$DEST${NC}" # 目标目录不存在则创建 mkdir -p "$(dirname "$DEST")" diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 5996ccf..42fea48 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -15,6 +15,8 @@ bind | splitw -h -c '#{pane_current_path}' set -g default-terminal "screen-256color" set -ga terminal-overrides ",*256col*:Tc" +set-option -a terminal-features 'xterm-ghostty:RGB' + # 开启鼠标模式 set -g mouse on @@ -58,6 +60,16 @@ set -g set-titles-string "#{session_name}" set -s set-clipboard on set -g allow-passthrough on +# 1. 显式告诉 tmux 你的外壳终端支持 osc9 属性 +set -as terminal-features ",*:osc9" + +# 2. 强行把底层的 OSC 9 映射为直接穿透的转义包装 +# \E]9;%p1%s\007 会被 tmux 自动包装成 \033Ptmux;\033]9;...\007\033\\ 发送出去 +set -as terminal-overrides ",*:OSC 9=..." +#set -as terminal-overrides ",screen-256color:XT:OSC 9=\\E]9;%p1%s\\007" +set -as terminal-overrides ",screen*:OSC 9=..." +set -as terminal-overrides ",xterm*:OSC 9=..." + # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible'