add fish config

This commit is contained in:
FlintyLemming
2025-12-19 21:02:38 +08:00
parent 44da080b9c
commit d4beabc4a7

View File

@@ -1,59 +1,63 @@
fish_add_path ~/.flinty/bin
# 设置欢迎语
# 禁用 Fish 默认欢迎语
set -g fish_greeting ""
function fish_greeting
echo ""
# 1. 顶部欢迎与时间 (强制显示为 UTC-8)
# 1. 顶部欢迎与 UTC-8 时间
set_color -o cyan
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"
# 在 TZ 环境变量中GMT+8 指向西八区 (UTC-8)
set -l current_time (env TZ="GMT+8" date "+%Y-%m-%d %H:%M:%S")
echo " Time (UTC-8): $current_time"
set_color normal
echo ""
# 2. 调用 Fetch 工具获取系统硬件信息
# 2. 系统硬件信息 (仅文字,无 Logo)
if type -q fastfetch
# fastfetch 性能最好,支持高度自定义结构
fastfetch --structure OS:CPU:GPU:Memory:Disk --color cyan
# --logo none 隐藏左侧图标
# --structure OS:CPU:GPU:Memory:Disk 仅显示指定项
fastfetch --logo none \
--structure OS:CPU:GPU:Memory:Disk \
--color cyan
else if type -q neofetch
# neofetch 备选,由于其默认输出较杂,通过参数精简
# 包含 OS, CPU, GPU, Memory, Disk
neofetch --disable underline title separator \
# --off 禁用 Logo
neofetch --off \
--disable underline title separator \
--os_arch off \
--cpu_temp off --gpu_type all --mem_unit mib \
--cpu_temp off \
--gpu_type all \
--mem_unit mib \
--os --cpu --memory --disk --gpu
else
# 如果都没安装,则提示
set_color yellow
echo " ⚠️ System info tools (fastfetch/neofetch) are not installed."
echo " ⚠️ fastfetch/neofetch not found. Please install one for system info."
set_color normal
end
echo " ----------------------------------------"
# 3. 包管理器逻辑 (优先检查 oma)
set -l pm_info ""
set -l pm_name ""
if type -q oma
set pm_info (set_color -o green)"oma"(set_color normal)
set pm_name (set_color -o green)"oma"(set_color normal)
else
# 按照常见系统优先级检查
# 回退到系统默认包管理器
if type -q brew
set pm_info "Homebrew"
set pm_name "Homebrew"
else if type -q apt
set pm_info "apt"
set pm_name "apt"
else if type -q pacman
set pm_info "pacman"
set pm_name "pacman"
else if type -q dnf
set pm_info "dnf"
set pm_name "dnf"
else
set pm_info "Default System PM"
set pm_name "Default PM"
end
end
echo " 󰏗 Package Manager: $pm_info"
echo " 󰏗 Package Manager: $pm_name"
echo ""
end