diff --git a/fish/add-on.fish b/fish/add-on.fish index 0d6cdc0..04dc7c2 100644 --- a/fish/add-on.fish +++ b/fish/add-on.fish @@ -1,5 +1,49 @@ fish_add_path ~/.flinty/bin +# 设置欢迎语 +set -g fish_greeting "" + +function fish_greeting + # 1. 打印欢迎头部 + set_color -o cyan + echo "Welcome back, $USER!" + + # 修改点:使用 env TZ="Etc/GMT+8" 来强制输出 UTC-8 时间 + set -l current_time (env TZ="Etc/GMT+8" date "+%Y-%m-%d %H:%M:%S") + echo "Current Time (UTC-8): $current_time" + + set_color normal + echo "----------------------------------------" + + # 2. 调用 fastfetch/neofetch 输出硬件信息 + if type -q fastfetch + fastfetch --structure CPU:Memory:Disk:GPU --color cyan + else if type -q neofetch + neofetch --disable underline title separator \ + --cpu_temp off --gpu_type all --mem_unit mib \ + --cpu --memory --disk --gpu + end + + echo "----------------------------------------" + + # 3. 检查包管理器逻辑 + set -l pkg_manager "" + if type -q oma + set pkg_manager (set_color green)"oma"(set_color normal) + else if type -q apt + set pkg_manager "apt" + else if type -q pacman + set pkg_manager "pacman" + else if type -q brew + set pkg_manager "Homebrew" + else + set pkg_manager "Default System PM" + end + + echo "Package Manager: $pkg_manager" + echo "" +end + ## 替换 ls 默认行为 function ls --description 'alias ls to eza if possible' # 1. 优先使用系统安装的 eza (PATH 里的)