add fish config
This commit is contained in:
@@ -4,43 +4,56 @@ fish_add_path ~/.flinty/bin
|
|||||||
set -g fish_greeting ""
|
set -g fish_greeting ""
|
||||||
|
|
||||||
function fish_greeting
|
function fish_greeting
|
||||||
# 1. 打印欢迎头部
|
echo ""
|
||||||
|
# 1. 顶部欢迎与时间 (强制显示为 UTC-8)
|
||||||
set_color -o cyan
|
set_color -o cyan
|
||||||
echo "Welcome back, $USER!"
|
echo " Welcome back, $USER"
|
||||||
|
# 在 TZ 变量中,GMT+8 代表 UTC-8 (西八区)
|
||||||
# 修改点:使用 env TZ="Etc/GMT+8" 来强制输出 UTC-8 时间
|
set -l utc_minus_8 (env TZ="GMT+8" date "+%Y-%m-%d %H:%M:%S")
|
||||||
set -l current_time (env TZ="Etc/GMT+8" date "+%Y-%m-%d %H:%M:%S")
|
echo " Time (UTC-8): $utc_minus_8"
|
||||||
echo "Current Time (UTC-8): $current_time"
|
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
echo "----------------------------------------"
|
echo ""
|
||||||
|
|
||||||
# 2. 调用 fastfetch/neofetch 输出硬件信息
|
# 2. 调用 Fetch 工具获取系统及硬件信息
|
||||||
if type -q fastfetch
|
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
|
else if type -q neofetch
|
||||||
|
# neofetch 备选,由于其默认输出较杂,通过参数精简
|
||||||
|
# 包含 OS, CPU, GPU, Memory, Disk
|
||||||
neofetch --disable underline title separator \
|
neofetch --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 \
|
||||||
--cpu --memory --disk --gpu
|
--os --cpu --memory --disk --gpu
|
||||||
|
else
|
||||||
|
# 如果都没安装,则提示
|
||||||
|
set_color yellow
|
||||||
|
echo " ⚠️ System info tools (fastfetch/neofetch) are not installed."
|
||||||
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
echo " ----------------------------------------"
|
echo " ----------------------------------------"
|
||||||
|
|
||||||
# 3. 检查包管理器逻辑
|
# 3. 包管理器逻辑 (优先检查 oma)
|
||||||
set -l pkg_manager ""
|
set -l pm_info ""
|
||||||
if type -q oma
|
if type -q oma
|
||||||
set pkg_manager (set_color green)"oma"(set_color normal)
|
set pm_info (set_color -o 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
|
else
|
||||||
set pkg_manager "Default System PM"
|
# 按照常见系统优先级检查
|
||||||
|
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
|
end
|
||||||
|
|
||||||
echo "Package Manager: $pkg_manager"
|
echo " Package Manager: $pm_info"
|
||||||
echo ""
|
echo ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user