diff --git a/ghostty/config b/ghostty/config new file mode 100644 index 0000000..4824675 --- /dev/null +++ b/ghostty/config @@ -0,0 +1,37 @@ +# 主题推荐:Catppuccin, Tokyo Night, 或 Gruvbox +theme = Atom One Dark + +# 字体设置 (建议安装带 Nerd Font 图标的字体) +font-family = "FiraCode Nerd Font" +font-size = 16 +font-feature = -calt # 如果你不喜欢连字(Ligatures)可以禁用 + +# 窗口样式:隐藏标题栏,让视觉更纯粹 +window-decoration = true +macos-titlebar-style = transparent +window-title-font-family = "FiraCode Nerd Font" + +# 背景透明度与模糊 (适合 2017 MBP 的精致感) +background-opacity = 0.95 +background-blur-radius = 20 + + +# 将 Option 键映射为 Alt/Meta 键 (对 Neovim/Tmux 极其重要) +macos-option-as-alt = true + +# 自动定位到当前 Shell 所在的目录 +working-directory = home + +# 选中文本时自动复制到剪贴板 +copy-on-select = true + +# 确认退出(防止误触 Command+Q 关掉正在运行的任务) +confirm-close-surface = true + +# 光标样式:块状且闪烁 +cursor-style = block +cursor-style-blink = true + +# 滚动条设置:通常建议隐藏,通过 Tmux 控制滚动 +mouse-scroll-multiplier = 1 +scrollback-limit = 10000 diff --git a/script/ghostty-init.sh b/script/ghostty-init.sh new file mode 100755 index 0000000..614dbdf --- /dev/null +++ b/script/ghostty-init.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -e + +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +SRC="$HOME/.dotfile/ghostty/config" +DEST="$HOME/.config/ghostty/config" + +echo -e "${YELLOW}初始化 Ghostty 配置...${NC}" + +# 目标目录不存在则创建 +mkdir -p "$(dirname "$DEST")" + +# 已经是指向正确位置的软链接,无需操作 +if [ -L "$DEST" ] && [ "$(readlink -f "$DEST")" = "$(readlink -f "$SRC")" ]; then + echo -e "${GREEN}软链接已存在且指向正确位置,无需操作。${NC}" + exit 0 +fi + +# 存在旧文件/目录则备份 +if [ -e "$DEST" ]; then + BACKUP="${DEST}.backup.$(date +%Y%m%d%H%M%S)" + mv "$DEST" "$BACKUP" + echo -e "${YELLOW}已将现有配置备份到 $BACKUP${NC}" +elif [ -L "$DEST" ]; then + # 损坏的旧软链接 + rm "$DEST" +fi + +ln -s "$SRC" "$DEST" + +if [ -L "$DEST" ] && [ "$(readlink -f "$DEST")" = "$(readlink -f "$SRC")" ]; then + echo -e "${GREEN}软链接创建成功:$DEST -> $SRC${NC}" +else + echo -e "${RED}软链接创建失败,请检查路径和权限。${NC}" + exit 1 +fi