From 44da080b9ca36126ddf5c2208fda1e39c3b6dd32 Mon Sep 17 00:00:00 2001 From: FlintyLemming Date: Fri, 19 Dec 2025 21:00:51 +0800 Subject: [PATCH] add fish config --- fish/add-on.fish | 67 +++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/fish/add-on.fish b/fish/add-on.fish index 04dc7c2..b91d402 100644 --- a/fish/add-on.fish +++ b/fish/add-on.fish @@ -4,43 +4,56 @@ fish_add_path ~/.flinty/bin set -g fish_greeting "" function fish_greeting - # 1. 打印欢迎头部 + echo "" + # 1. 顶部欢迎与时间 (强制显示为 UTC-8) 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" - + echo "  Welcome back, $USER" + # 在 TZ 变量中,GMT+8 代表 UTC-8 (西八区) + set -l utc_minus_8 (env TZ="GMT+8" date "+%Y-%m-%d %H:%M:%S") + echo " Time (UTC-8): $utc_minus_8" set_color normal - echo "----------------------------------------" + echo "" - # 2. 调用 fastfetch/neofetch 输出硬件信息 + # 2. 调用 Fetch 工具获取系统及硬件信息 if type -q fastfetch - fastfetch --structure CPU:Memory:Disk:GPU --color cyan + # fastfetch 性能最好,支持高度自定义结构 + fastfetch --structure OS:CPU:GPU:Memory:Disk --color cyan else if type -q neofetch + # neofetch 备选,由于其默认输出较杂,通过参数精简 + # 包含 OS, CPU, GPU, Memory, Disk neofetch --disable underline title separator \ + --os_arch off \ --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" + --os --cpu --memory --disk --gpu else - set pkg_manager "Default System PM" + # 如果都没安装,则提示 + set_color yellow + echo " ⚠️ System info tools (fastfetch/neofetch) are not installed." + set_color normal end - echo "Package Manager: $pkg_manager" + echo " ----------------------------------------" + + # 3. 包管理器逻辑 (优先检查 oma) + set -l pm_info "" + if type -q oma + set pm_info (set_color -o green)"oma"(set_color normal) + else + # 按照常见系统优先级检查 + if type -q brew + set pm_info "Homebrew" + else if type -q apt + set pm_info "apt" + else if type -q pacman + set pm_info "pacman" + else if type -q dnf + set pm_info "dnf" + else + set pm_info "Default System PM" + end + end + + echo " 󰏗 Package Manager: $pm_info" echo "" end