This commit is contained in:
2026-03-31 20:13:15 +08:00
parent 48044e957d
commit 08c513b995
1155 changed files with 79920 additions and 0 deletions

View File

@ -0,0 +1,124 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/master/doc/json_schema.json",
"logo": {
"type": "kitty",
//"source": "/home/shorin/Pictures/picture.png",
"width": 25,
// "height":20,
"padding": {
"top": 1, // Top padding
"left": 2, // Left padding
"right": 2 // Right padding
},
},
"display": {
"separator": " ", // Separator between keys and values
"color": {
//"keys": "#b7c9d9", // Key color module名字的颜色
"title": "#c1c7ce", // Title color 主机名的颜色
"output": "#c1c7ce"
},
},
"modules": [
"break",
{
"type": "os", //这是哪个module
"key": "OS", //module名字的显示
// "keyColor": "#00ff00", //module名字颜色
// "format": "{name} {version}", //具体内容
"keyColor": "#96cdf8",
},
{
"type": "kernel",
"key": " ├  KER ",
"keyColor": "#96cdf8",
},
{
"type": "packages",
"key": " ├  PAK ",
"format": "{all}",
"keyColor": "#96cdf8",
},
{
"type": "title",
"key": " └  USR ",
"keyColor": "#96cdf8",
},
"break",
"break",
{
"type": "wm",
"key": "WM",
"keyColor": "#cfc0e8",
},
{
"type": "de",
"key": " ├ 󱈹 DES ",
"keyColor": "#cfc0e8",
//"outputColor": "#cfc0e8"
},
{
"type": "shell",
"key": " ├  SHE ",
"keyColor": "#cfc0e8",
//"outputColor": "#cfc0e8"
},
{
"type": "terminal",
"key": " ├  TER ",
"keyColor": "#cfc0e8",
//"outputColor": "#cfc0e8"
},
{
"type": "terminalfont",
"key": " └  TFO ",
"keyColor": "#cfc0e8",
//"outputColor": "#cfc0e8"
},
"break",
"break",
{
"type": "host",
"key": "PC ",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
{
"type": "cpu",
"key": " ├  CPU ",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
{
"type": "memory",
"key": " ├  MEM ",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
{
"type": "gpu",
"key": " ├ 󰢮 GPU ",
"format": "{1} {2}",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
{
"type": "display",
"key": " ├  MON ",
"format": "{name} {width}x{height}@{refresh-rate} ",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
{
"type": "disk",
"key": " └ 󰋊 DIS ",
"keyColor": "#d3e5f5",
//"outputColor": "#b7c9d9"
},
"break",
"break",
"colors"
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
# 转换引擎
Engine=OpenCC
# 启用的输入法
EnabledIM=
# 简转繁的 OpenCC 配置
OpenCCS2TProfile=default
# 繁转简的 OpenCC 配置
OpenCCT2SProfile=default
[Hotkey]
0=Control+Shift+F

View File

@ -0,0 +1,35 @@
# Vertical Candidate List
Vertical Candidate List=True
# Use mouse wheel to go to prev or next page
WheelForPaging=True
# Font
Font="Sans Serif 11"
# Menu Font
MenuFont="Sans Serif 10"
# Tray Font
TrayFont="Sans Serif 10"
# Tray Label Outline Color
TrayOutlineColor=#000000
# Tray Label Text Color
TrayTextColor=#ffffff
# Prefer Text Icon
PreferTextIcon=False
# Show Layout Name In Icon
ShowLayoutNameInIcon=True
# Use input method language to display text
UseInputMethodLanguageToDisplayText=True
# Theme
Theme=default
# Dark Theme
DarkTheme=default-dark
# Follow system light/dark color scheme
UseDarkTheme=False
# Follow system accent color if it is supported by theme and desktop
UseAccentColor=True
# Use Per Screen DPI on X11
PerScreenDPI=False
# Force font DPI on Wayland
ForceWaylandDPI=0
# Enable fractional scale under Wayland
EnableFractionalScale=True

View File

@ -0,0 +1,3 @@
# 隐藏通知
HiddenNotifications=

View File

@ -0,0 +1,150 @@
# 双拼方案
ShuangpinProfile=Ziranma
# 显示当前双拼模式
ShowShuangpinMode=True
# 每页候选词
PageSize=5
# 显示英文候选词
SpellEnabled=True
# 显示符号候选词
SymbolsEnabled=True
# 显示拆字候选词
ChaiziEnabled=True
# 启用 Unicode CJK 拓展区 B 之后的更多字符
ExtBEnabled=True
# 输入 h(横)s(竖)p(撇)n(捺)z(折) 时显示笔画候选词
StrokeCandidateEnabled=True
# 启用云拼音
CloudPinyinEnabled=True
# 云拼音候选词顺序
CloudPinyinIndex=2
# 加载云拼音的时候显示动画
CloudPinyinAnimation=True
# 总是显示云拼音的占位符
KeepCloudPinyinPlaceHolder=False
# 预编辑模式
PreeditMode="Composing pinyin"
# 将嵌入预编辑文本的光标固定在开头
PreeditCursorPositionAtBeginning=True
# 在预编辑中显示完整拼音
PinyinInPreedit=False
# 启用预测
Prediction=False
# Keep the current typed text for next input prediction
KeepCurrentContext=True
# 预测数量
PredictionSize=49
# 预测时退格键的行为
BackspaceBehaviorOnPrediction="Backspace when not using on-screen keyboard"
# 切换输入法时的行为
SwitchInputMethodBehavior="Commit current preedit"
# 选择第二个候选词
SecondCandidate=
# 选择第三个候选词
ThirdCandidate=
# 使用数字键盘选词
UseKeypadAsSelection=False
# 使用退格键取消选词
BackSpaceToUnselect=True
# 句子数量
Number of sentence=2
# 词组候选词数
WordCandidateLimit=15
# 输入长于...时提示长词 (设置为 0 时禁用)
LongWordLengthLimit=4
# 快速输入的触发键
QuickPhraseKey=semicolon
# 使用 V 来触发快速输入
VAsQuickphrase=True
# FirstRun
FirstRun=False
[ForgetWord]
0=Control+7
[PrevPage]
0=minus
1=Up
2=KP_Up
3=Page_Up
[NextPage]
0=equal
1=Down
2=KP_Down
3=Next
[PrevCandidate]
0=Shift+Tab
[NextCandidate]
0=Tab
[CurrentCandidate]
0=space
1=KP_Space
[CommitRawInput]
0=Return
1=KP_Enter
2=Control+Return
3=Control+KP_Enter
4=Shift+Return
5=Shift+KP_Enter
6=Control+Shift+Return
7=Control+Shift+KP_Enter
[ChooseCharFromPhrase]
0=bracketleft
1=bracketright
[FilterByStroke]
0=grave
[QuickPhraseTriggerRegex]
0=.(/|@)$
1=^(www|bbs|forum|mail|bbs)\\.
2=^(http|https|ftp|telnet|mailto):
[Fuzzy]
# ue -> ve
VE_UE=True
# 常见错误
NG_GN=True
# 内模糊音节 (xian -> xi'an)
Inner=True
# 短拼音的内模糊音节 (qie -> qi'e)
InnerShort=True
# 匹配不完整的元音 (e -> en, eng, ei)
PartialFinal=True
# 输入长度大于 4 时进行部分双拼匹配
PartialSp=False
# u <-> v
V_U=False
# an <-> ang
AN_ANG=False
# en <-> eng
EN_ENG=False
# ian <-> iang
IAN_IANG=False
# in <-> ing
IN_ING=False
# u <-> ou
U_OU=False
# uan <-> uang
UAN_UANG=False
# c <-> ch
C_CH=False
# f <-> h
F_H=False
# l <-> n
L_N=False
# l <-> r
L_R=False
# s <-> sh
S_SH=False
# z <-> zh
Z_ZH=False
# 纠错布局
Correction=None

View File

@ -0,0 +1,10 @@
# 字母或者数字之后输入半角标点
HalfWidthPuncAfterLetterOrNumber=True
# 同时输入成对标点 (例如引号)
TypePairedPunctuationsTogether=False
# Enabled
Enabled=True
[Hotkey]
0=Control+period

View File

@ -0,0 +1,83 @@
[Hotkey]
# 按住切换键的修饰键时进行轮换切换
EnumerateWithTriggerKeys=True
# 向前切换输入法
EnumerateForwardKeys=
# 向后切换输入法
EnumerateBackwardKeys=
# 轮换输入法时跳过第一个输入法
EnumerateSkipFirst=False
# 触发修饰键快捷键的时限 (毫秒)
ModifierOnlyKeyTimeout=250
[Hotkey/TriggerKeys]
0=Control+space
1=Zenkaku_Hankaku
2=Hangul
[Hotkey/ActivateKeys]
0=Hangul_Hanja
[Hotkey/DeactivateKeys]
0=Hangul_Romaja
[Hotkey/AltTriggerKeys]
0=Shift_L
[Hotkey/EnumerateGroupForwardKeys]
0=Super+space
[Hotkey/EnumerateGroupBackwardKeys]
0=Shift+Super+space
[Hotkey/PrevPage]
0=Up
[Hotkey/NextPage]
0=Down
[Hotkey/PrevCandidate]
0=Shift+Tab
[Hotkey/NextCandidate]
0=Tab
[Hotkey/TogglePreedit]
0=Control+Alt+P
[Behavior]
# 默认状态为激活
ActiveByDefault=False
# 重新聚焦时重置状态
resetStateWhenFocusIn=No
# 共享输入状态
ShareInputState=No
# 在程序中显示预编辑文本
PreeditEnabledByDefault=True
# 切换输入法时显示输入法信息
ShowInputMethodInformation=True
# 在焦点更改时显示输入法信息
showInputMethodInformationWhenFocusIn=False
# 显示紧凑的输入法信息
CompactInputMethodInformation=True
# 显示第一个输入法的信息
ShowFirstInputMethodInformation=True
# 默认页大小
DefaultPageSize=5
# 覆盖 XKB 选项
OverrideXkbOption=False
# 自定义 XKB 选项
CustomXkbOption=
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True
# 允许在密码框中使用输入法
AllowInputMethodForPassword=False
# 输入密码时显示预编辑文本
ShowPreeditForPassword=False
# 保存用户数据的时间间隔(以分钟为单位)
AutoSavePeriod=30

View File

@ -0,0 +1,23 @@
[Groups/0]
# Group Name
Name=默认
# Layout
Default Layout=us
# Default Input Method
DefaultIM=rime
[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=
[Groups/0/Items/1]
# Name
Name=rime
# Layout
Layout=
[GroupOrder]
0=默认

View File

@ -0,0 +1,56 @@
if status is-interactive
# Commands to run in interactive sessions can go here
end
set fish_greeting ""
set -p PATH ~/.local/bin
starship init fish | source
zoxide init fish --cmd cd | source
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
end
function cat
command bat $argv
end
function ls
command eza --icons $argv
end
function lt
command eza --icons --tree $argv
end
# grub
abbr grub 'LANGUAGE=en_US.UTF-8 LANG=en_US.UTF-8 sudo grub-mkconfig -o /boot/grub/grub.cfg'
# 小黄鸭补帧 需要steam安装正版小黄鸭
abbr lsfg 'LSFG_PROCESS="miyu"'
# fa运行fastfetch
abbr fa fastfetch
abbr reboot 'systemctl reboot'
function sl
command sl | lolcat
end
function
sysup
end
function raw
command ~/.config/scripts/random-anime-wallpaper.sh $argv
end
function 安装
command yay -S $argv
end
function 卸载
command yay -Rns $argv
end
# Added by LM Studio CLI (lms)
set -gx PATH $PATH /home/shorin/.lmstudio/bin
# End of LM Studio CLI section

View File

@ -0,0 +1,171 @@
# ==============================================================================
# Function: apt (Smart Arch Package Manager Wrapper for Fish)
# Description: Maps common Debian 'apt' commands to an intelligent Arch backend.
# Features:
# - Fallback routing: paru > yay > pacman.
# - Automatic Sudo Handling: Prevents AUR helpers from running as root.
# - Anti-Partial-Upgrade: Merges update/upgrade into a safe -Syu operation.
# - Deep Clean Default: Merges remove/purge into -Rns for a pristine system.
# - UI Integration: Progressive enhancement with 'shorin' for interactive modes.
# - Safe orphan detection and i18n support.
# - Highly readable, colorized, and column-aligned help output.
# Usage: apt {update|upgrade|install [ui]|remove [ui]|search|show|autoremove|clean|help|-h} [pkg...]
# ==============================================================================
function apt -d "Smart wrapper routing apt commands to paru/yay/pacman"
# 1. 极简的 Locale 探测
set -l is_zh 0
if string match -q -r "^zh_" "$LC_ALL" "$LC_MESSAGES" "$LANG"
set is_zh 1
end
# 2. 探测 shorin UI 工具是否存在
set -l has_shorin 0
if command -q shorin
set has_shorin 1
end
set -l action "help"
set -l exit_code 0
if test (count $argv) -eq 0
set exit_code 1
else
set action $argv[1]
set -e argv[1]
end
# 3. 帮助信息拦截与本地化 (重构的高颜值排版)
switch $action
case help -h --help
set -l c_cmd (set_color cyan)
set -l c_hl (set_color yellow)
set -l c_rst (set_color normal)
if test $is_zh -eq 1
echo "Arch 包管理器包装器 (优先级: "$c_hl"paru > yay > pacman"$c_rst")"
echo "用法: "$c_hl"apt"$c_rst" <命令> [软件包...]"
echo ""
echo "命令:"
echo " "$c_cmd"update(upgrade)"$c_rst" 同步数据库并更新系统 (-Syu)"
echo " "$c_cmd"install "$c_rst" 安装软件包 (-S)"
if test $has_shorin -eq 1
echo " "$c_cmd"install ui "$c_rst" 打开交互式界面安装 (依赖: shorin-contrib-git)"
end
echo " "$c_cmd"remove "$c_rst" 彻底卸载软件包、依赖及配置文件 (-Rns)"
if test $has_shorin -eq 1
echo " "$c_cmd"remove ui "$c_rst" 打开交互式界面卸载 (依赖: shorin-contrib-git)"
end
echo " "$c_cmd"search "$c_rst" 搜索软件包 (-Ss)"
echo " "$c_cmd"show "$c_rst" 显示软件包详细信息 (-Si)"
echo " "$c_cmd"autoremove "$c_rst" 安全地清理系统中的孤立软件包"
echo " "$c_cmd"clean "$c_rst" 清理下载缓存 (-Sc)"
echo " "$c_cmd"help, -h "$c_rst" 显示此帮助信息"
else
echo "Smart Arch Package Wrapper (Routing: "$c_hl"paru > yay > pacman"$c_rst")"
echo "Usage: "$c_hl"apt"$c_rst" <command> [package...]"
echo ""
echo "Commands:"
echo " "$c_cmd"update(upgrade)"$c_rst" Sync databases and update system (Safe -Syu)"
echo " "$c_cmd"install "$c_rst" Install packages (-S)"
if test $has_shorin -eq 1
echo " "$c_cmd"install ui "$c_rst" Open interactive installation UI (shorin pac)"
end
echo " "$c_cmd"remove "$c_rst" Remove packages, unneeded dependencies, and configs (-Rns)"
if test $has_shorin -eq 1
echo " "$c_cmd"remove ui "$c_rst" Open interactive removal UI (shorin pacr)"
end
echo " "$c_cmd"search "$c_rst" Search for packages (-Ss)"
echo " "$c_cmd"show "$c_rst" Show package details (-Si)"
echo " "$c_cmd"autoremove "$c_rst" Remove orphaned packages safely"
echo " "$c_cmd"clean "$c_rst" Clean package cache (-Sc)"
echo " "$c_cmd"help, -h "$c_rst" Show this help message"
end
return $exit_code
end
# 4. 核心路由与提权逻辑
set -l pkg_mgr
set -l needs_sudo "no"
if command -q paru
set pkg_mgr "paru"
else if command -q yay
set pkg_mgr "yay"
else
set pkg_mgr "pacman"
set needs_sudo "yes"
end
set -l cmd
if test "$needs_sudo" = "yes"
set cmd sudo $pkg_mgr
else
set cmd $pkg_mgr
end
# 5. 预定义基础错误信息 (本地化)
set -l msg_err_pkg "Error: Specify packages."
set -l msg_err_search "Error: Specify search term."
set -l msg_err_show "Error: Specify package to show."
if test $is_zh -eq 1
set msg_err_pkg "错误:请指定要操作的软件包。"
set msg_err_search "错误:请指定搜索词。"
set msg_err_show "错误:请指定要查看的软件包。"
end
# 6. 动作映射 (Action Mapping)
switch $action
case update upgrade
$cmd -Syu
case install
if test (count $argv) -eq 0; echo $msg_err_pkg; return 1; end
# 拦截 'install ui',条件:且只输入了 ui 一个参数,且系统存在 shorin
if test "$argv[1]" = "ui" -a (count $argv) -eq 1 -a $has_shorin -eq 1
shorin pac
return 0
end
$cmd -S $argv
case remove
if test (count $argv) -eq 0; echo $msg_err_pkg; return 1; end
# 拦截 'remove ui'
if test "$argv[1]" = "ui" -a (count $argv) -eq 1 -a $has_shorin -eq 1
shorin pacr
return 0
end
$cmd -Rns $argv
case search
if test (count $argv) -eq 0; echo $msg_err_search; return 1; end
$pkg_mgr -Ss $argv
case show
if test (count $argv) -eq 0; echo $msg_err_show; return 1; end
$pkg_mgr -Si $argv
case autoremove
set -l orphans (pacman -Qtdq)
if test (count $orphans) -gt 0
if test $is_zh -eq 1
echo "找到 "(count $orphans)" 个孤立的软件包。正在通过 $pkg_mgr 卸载..."
else
echo "Found "(count $orphans)" orphaned package(s). Removing via $pkg_mgr..."
end
$cmd -Rns $orphans
else
if test $is_zh -eq 1
echo "系统很干净,没有需要清理的孤立软件包。"
else
echo "System is clean. No orphaned packages to remove."
end
end
case clean
$cmd -Sc
case '*'
if test $is_zh -eq 1
echo "错误:不支持的 apt 命令映射: $action"
echo "运行 'apt -h' 查看可用命令。"
else
echo "Error: Unsupported apt command mapped: $action"
echo "Run 'apt -h' for valid commands."
end
return 1
end
end

View File

@ -0,0 +1,252 @@
function f
# ==============================================================================
# 【脚本功能说明】
# 1. 结合 Fastfetch在终端启动时展示随机二次元图片 (支持 SFW / NSFW 模式)。
# 2. 具备静默后台异步下载机制,库存不足时自动补货,绝不阻塞前台终端的启动。
# 3. 具备智能缓存管理机制,自动控制待展示区与已使用区 (used) 的图片数量上限。
# 4. 具备极致的网络环境容错处理,无网或弱网时自动降级 fallback避免死等。
# 5. 具备自动清理 Fastfetch 内部生成的图片转换缓存功能,防止磁盘空间无感膨胀。
# ==============================================================================
# ================= 配置区域 =================
# [开关] 阅后即焚模式 (针对 Fastfetch 内部缓存)
# true = 运行后强力清空 ~/.cache/fastfetch/images/ (防止转码缓存膨胀)
# false = 保留缓存
set -l CLEAN_CACHE_MODE true
# 每次补货下载多少张
set -l DOWNLOAD_BATCH_SIZE 10
# 最大库存上限 (待展示区)
set -l MAX_CACHE_LIMIT 100
# 库存少于多少张时开始补货
set -l MIN_TRIGGER_LIMIT 60
# [新增] used 目录最大存放数量
# 超过此数量将按照时间顺序删除最旧的文件
set -l MAX_USED_LIMIT 50
# ===========================================
# --- 0. 参数解析与模式设置 ---
set -l NSFW_MODE false
# 检查环境变量
if test "$NSFW" = "1"
set NSFW_MODE true
end
set -l ARGS_FOR_FASTFETCH
for arg in $argv
if test "$arg" = "--nsfw"
set NSFW_MODE true
else
set -a ARGS_FOR_FASTFETCH $arg
end
end
# --- 1. 目录配置 ---
# 根据模式区分缓存目录和锁文件
set -l CACHE_DIR
set -l LOCK_FILE
if test "$NSFW_MODE" = true
set CACHE_DIR "$HOME/.cache/fastfetch_waifu_nsfw"
set LOCK_FILE "/tmp/fastfetch_waifu_nsfw.lock"
else
set CACHE_DIR "$HOME/.cache/fastfetch_waifu"
set LOCK_FILE "/tmp/fastfetch_waifu.lock"
end
# 定义已使用目录
set -l USED_DIR "$CACHE_DIR/used"
mkdir -p "$CACHE_DIR"
mkdir -p "$USED_DIR"
# --- 2. 核心函数 ---
# [修复] 抛弃脆弱的 1.1.1.1,使用苹果的全球探针节点,并使用 -I (HEAD请求) 极限提速
function check_network
curl -sI --connect-timeout 2 "http://captive.apple.com/hotspot-detect.html" >/dev/null 2>&1
return $status
end
function get_random_url -V NSFW_MODE
set -l TIMEOUT --connect-timeout 5 --max-time 15
set -l RAND (math (random) % 3 + 1)
if test "$NSFW_MODE" = true
# === NSFW API ===
switch $RAND
case 1
curl -s $TIMEOUT "https://api.waifu.im/images?IncludedTags=waifu&IsNsfw=true" | jq -r '.images[0].url'
case 2
curl -s $TIMEOUT "https://api.waifu.pics/nsfw/waifu" | jq -r '.url'
case 3
curl -s $TIMEOUT "https://api.waifu.pics/nsfw/neko" | jq -r '.url'
end
else
# === SFW (正常) API ===
switch $RAND
case 1
# [修复] IsNsfwfalse 修正为 IsNsfw=false
curl -s $TIMEOUT "https://api.waifu.im/images?IncludedTags=waifu&IsNsfw=false" | jq -r '.images[0].url'
case 2
curl -s $TIMEOUT "https://nekos.best/api/v2/waifu" | jq -r '.results[0].url'
case 3
curl -s $TIMEOUT "https://api.waifu.pics/sfw/waifu" | jq -r '.url'
end
end
end
function download_one_image -V CACHE_DIR
set -l URL (get_random_url)
if string match -qr "^http" -- "$URL"
# 使用带时间戳的随机文件名
set -l FILENAME "waifu_"(date +%s%N)"_"(random)".jpg"
set -l TARGET_PATH "$CACHE_DIR/$FILENAME"
curl -s -L --connect-timeout 5 --max-time 15 -o "$TARGET_PATH" "$URL"
# 简单校验
if test -s "$TARGET_PATH"
if command -v file >/dev/null 2>&1
if not file --mime-type "$TARGET_PATH" | grep -q "image/"
rm -f "$TARGET_PATH"
end
end
else
rm -f "$TARGET_PATH"
end
end
end
function background_job -V CACHE_DIR -V LOCK_FILE -V MIN_TRIGGER_LIMIT -V DOWNLOAD_BATCH_SIZE -V MAX_CACHE_LIMIT -V NSFW_MODE
# 导出函数定义以便在 fish -c 中使用
set -l get_random_url_def (functions get_random_url | string collect)
set -l download_one_image_def (functions download_one_image | string collect)
set -l check_network_def (functions check_network | string collect)
fish -c "
# [核心修复 1] 忽略终端关闭带来的 SIGHUP 信号
trap '' HUP
# 重新定义需要的函数
$get_random_url_def
$download_one_image_def
$check_network_def
# 使用 flock 防止并发
flock -n 200 || exit 1
# [新增] 网络检查,没网就悄悄退出,不占后台资源
if not check_network
exit 0
end
# 导入变量
set CACHE_DIR '$CACHE_DIR'
set NSFW_MODE '$NSFW_MODE'
# 1. 补货检查
set CURRENT_COUNT (find \$CACHE_DIR -maxdepth 1 -name '*.jpg' 2>/dev/null | wc -l)
if test \$CURRENT_COUNT -lt $MIN_TRIGGER_LIMIT
for i in (seq 1 $DOWNLOAD_BATCH_SIZE)
download_one_image
sleep 0.5
end
end
# 2. 清理过多库存 (清理的是下载缓存区,不是 used 区)
set FINAL_COUNT (find \$CACHE_DIR -maxdepth 1 -name '*.jpg' 2>/dev/null | wc -l)
if test \$FINAL_COUNT -gt $MAX_CACHE_LIMIT
set DELETE_START_LINE (math $MAX_CACHE_LIMIT + 1)
ls -tp \$CACHE_DIR/*.jpg 2>/dev/null | tail -n +\$DELETE_START_LINE | xargs -I {} rm -- '{}'
end
" 200>"$LOCK_FILE" &
# [核心修复 2] 将刚才丢入后台的 fish 子进程剥离终端控制
disown
end
# --- 3. 主程序逻辑 ---
set -l FILES $CACHE_DIR/*.jpg
set -l NUM_FILES (count $FILES)
# fish 若无匹配文件,$FILES 可能为空或保留模式字符串,需额外判断
if test "$NUM_FILES" -eq 1; and not test -f "$FILES[1]"
set NUM_FILES 0
set FILES
end
set -l SELECTED_IMG ""
if test "$NUM_FILES" -gt 0
# 有库存,随机选一张
set -l RAND_INDEX (math (random) % $NUM_FILES + 1)
set SELECTED_IMG "$FILES[$RAND_INDEX]"
# 后台补货
background_job >/dev/null 2>&1
else
# 没库存,提示语更改并增加网络连通性容错
echo "库存不够啦!正在去搬运新的图片,请稍等哦..."
if check_network
download_one_image
else
echo "网络好像不太通畅,无法下载新图片 QAQ"
end
set FILES $CACHE_DIR/*.jpg
if test -f "$FILES[1]"
set SELECTED_IMG "$FILES[1]"
background_job >/dev/null 2>&1
end
end
# 运行 Fastfetch
if test -n "$SELECTED_IMG"; and test -f "$SELECTED_IMG"
# 显示图片
fastfetch --logo "$SELECTED_IMG" --logo-preserve-aspect-ratio true $ARGS_FOR_FASTFETCH
# === 逻辑: 移动到 used 目录 ===
mv "$SELECTED_IMG" "$USED_DIR/"
# === 逻辑: 检查 used 目录并清理旧图 ===
# 注意fish 的 glob 展开如果文件太多可能会卡,但这里有 limit 限制所以还好
set -l used_files $USED_DIR/*.jpg
set -l used_count (count $used_files)
# 再次确认 count因为如果没文件 $used_files 可能为空
if test "$used_count" -gt 0; and not test -f "$used_files[1]"
set used_count 0
end
if test "$used_count" -gt "$MAX_USED_LIMIT"
# 计算需要跳过的行数 (保留最新的 N 张)
set -l skip_lines (math "$MAX_USED_LIMIT" + 1)
# 列出所有文件按时间倒序(tp),取尾部(tail),删除(rm)
# 2>/dev/null 防止目录为空时报错
set -l files_to_delete (ls -tp "$USED_DIR"/*.jpg 2>/dev/null | tail -n +$skip_lines)
if test -n "$files_to_delete"
rm -- $files_to_delete
end
end
# 检查是否开启清理 Fastfetch 内部缓存
if test "$CLEAN_CACHE_MODE" = true
# 仅删除缩略图缓存,保留原图
rm -rf "$HOME/.cache/fastfetch/images"
end
else
# 失败提示语更改
echo "图片获取失败了,这次只能先显示默认的 Logo 啦 QAQ"
fastfetch $ARGS_FOR_FASTFETCH
end
end

View File

@ -0,0 +1,3 @@
function fnsfw
f --nsfw
end

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<edit name="antialias" mode="assign"><bool>true</bool></edit>
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
<edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
</match>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans</family>
<family>Noto Sans CJK SC</family>
<family>Adwaita Sans</family>
<family>Liberation Sans</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Sans</family>
<family>Noto Sans CJK SC</family>
<family>Adwaita Sans</family>
<family>Liberation Sans</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>JetBrains Mono</family>
<family>JetBrains Maple Mono</family>
<family>Adwaita Mono</family>
</prefer>
</alias>
</fontconfig>

View File

@ -0,0 +1,15 @@
# 设置主题
theme = Matugen
command = /usr/bin/fish
#设置透明度
background-opacity=0.88
#设置字体
font-family= "JetBrains Maple Mono"
font-size = 15
#取消关闭时的确认
# confirm-close-surface = false
#设置左右边距
window-padding-x=10
#设置上下边距
window-padding-y=10

View File

@ -0,0 +1,6 @@
background = #101417
foreground = #e0e3e8
cursor-color = #e0e3e8
cursor-text = #c1c7ce
selection-background = #b7c9d9
selection-foreground = #22323f

View File

@ -0,0 +1,22 @@
palette = 0=#51576d
palette = 1=#e78284
palette = 2=#a6d189
palette = 3=#e5c890
palette = 4=#8caaee
palette = 5=#f4b8e4
palette = 6=#81c8be
palette = 7=#b5bfe2
palette = 8=#626880
palette = 9=#e78284
palette = 10=#a6d189
palette = 11=#e5c890
palette = 12=#8caaee
palette = 13=#f4b8e4
palette = 14=#81c8be
palette = 15=#a5adce
background = 303446
foreground = c6d0f5
cursor-color = f2d5cf
cursor-text = 303446
selection-background = 44495d
selection-foreground = c6d0f5

View File

@ -0,0 +1,22 @@
palette = 0=#494d64
palette = 1=#ed8796
palette = 2=#a6da95
palette = 3=#eed49f
palette = 4=#8aadf4
palette = 5=#f5bde6
palette = 6=#8bd5ca
palette = 7=#b8c0e0
palette = 8=#5b6078
palette = 9=#ed8796
palette = 10=#a6da95
palette = 11=#eed49f
palette = 12=#8aadf4
palette = 13=#f5bde6
palette = 14=#8bd5ca
palette = 15=#a5adcb
background = 24273a
foreground = cad3f5
cursor-color = f4dbd6
cursor-text = 24273a
selection-background = 3a3e53
selection-foreground = cad3f5

View File

@ -0,0 +1,30 @@
cursor-color = #eedfe3
cursor-text = #d4c2c8
background = #191114
foreground = #eedfe3
selection-background = #e0bdcb
selection-foreground = #412a34
palette =8=#9d8d92
palette =0=#4c4c4c
palette =1=#ac8a8c
palette =9=#c49ea0
palette =2=#8aac8b
palette =10=#9ec49f
palette =3=#aca98a
palette =11=#c4c19e
palette =4=#feb0d3
palette =12=#a39ec4
palette =5=#ac8aac
palette =13=#c49ec4
palette =6=#8aacab
palette =14=#9ec3c4
palette =15=#e7e7e7
palette =7=#f0f0f0

View File

@ -0,0 +1 @@
hwdec=auto-safe

View File

@ -0,0 +1,187 @@
# 脚本功能:
# 从随机老婆图片生成 API 下载图片并使用 Fastfetch 展示。
# 特性:支持 NSFW 模式,支持自动补货,支持已用图片归档与自动清理。
# ================= 配置区域 =================
# [开关] 强力清理 Fastfetch 内部缓存
# true = 每次运行后清理 ~/.cache/fastfetch/images/ (防止转码缓存膨胀)
# false = 保留 Fastfetch 内部缓存
CLEAN_CACHE_MODE=true
# 每次补货下载多少张
DOWNLOAD_BATCH_SIZE=10
# 最大库存上限 (待展示区)
MAX_CACHE_LIMIT=100
# 库存少于多少张时开始补货
MIN_TRIGGER_LIMIT=60
# [新增] used 目录最大存放数量
# 超过此数量将按照时间顺序删除最旧的文件
MAX_USED_LIMIT=50
# ===========================================
# --- 0. 参数解析与模式设置 ---
NSFW_MODE=false
# 检查环境变量
if [ "$NSFW" = "1" ]; then
NSFW_MODE=true
fi
ARGS_FOR_FASTFETCH=()
for arg in "$@"; do
if [ "$arg" == "--nsfw" ]; then
NSFW_MODE=true
else
ARGS_FOR_FASTFETCH+=("$arg")
fi
done
# --- 1. 目录配置 ---
# 根据模式区分缓存目录和锁文件
if [ "$NSFW_MODE" = true ]; then
CACHE_DIR="$HOME/.cache/fastfetch_waifu_nsfw"
LOCK_FILE="/tmp/fastfetch_waifu_nsfw.lock"
else
CACHE_DIR="$HOME/.cache/fastfetch_waifu"
LOCK_FILE="/tmp/fastfetch_waifu.lock"
fi
# 定义已使用目录
USED_DIR="$CACHE_DIR/used"
mkdir -p "$CACHE_DIR"
mkdir -p "$USED_DIR"
# --- 2. 核心函数 ---
get_random_url() {
local TIMEOUT="--connect-timeout 5 --max-time 15"
RAND=$(( ( RANDOM % 3 ) + 1 ))
if [ "$NSFW_MODE" = true ]; then
# === NSFW API ===
case $RAND in
1) curl -s $TIMEOUT "https://api.waifu.im/search?included_tags=waifu&is_nsfw=true" | jq -r '.images[0].url' ;;
2) curl -s $TIMEOUT "https://api.waifu.pics/nsfw/waifu" | jq -r '.url' ;;
3) curl -s $TIMEOUT "https://api.waifu.pics/nsfw/neko" | jq -r '.url' ;;
esac
else
# === SFW (正常) API ===
case $RAND in
1) curl -s $TIMEOUT "https://api.waifu.im/search?included_tags=waifu&is_nsfw=false" | jq -r '.images[0].url' ;;
2) curl -s $TIMEOUT "https://nekos.best/api/v2/waifu" | jq -r '.results[0].url' ;;
3) curl -s $TIMEOUT "https://api.waifu.pics/sfw/waifu" | jq -r '.url' ;;
esac
fi
}
download_one_image() {
URL=$(get_random_url)
if [[ "$URL" =~ ^http ]]; then
# 使用带时间戳的随机文件名
FILENAME="waifu_$(date +%s%N)_$RANDOM.jpg"
TARGET_PATH="$CACHE_DIR/$FILENAME"
curl -s -L --connect-timeout 5 --max-time 15 -o "$TARGET_PATH" "$URL"
# 简单校验
if [ -s "$TARGET_PATH" ]; then
if command -v file >/dev/null 2>&1; then
if ! file --mime-type "$TARGET_PATH" | grep -q "image/"; then
rm -f "$TARGET_PATH"
fi
fi
else
rm -f "$TARGET_PATH"
fi
fi
}
background_job() {
(
flock -n 200 || exit 1
# 1. 补货检查
CURRENT_COUNT=$(find "$CACHE_DIR" -maxdepth 1 -name "*.jpg" 2>/dev/null | wc -l)
if [ "$CURRENT_COUNT" -lt "$MIN_TRIGGER_LIMIT" ]; then
for ((i=1; i<=DOWNLOAD_BATCH_SIZE; i++)); do
download_one_image
sleep 0.5
done
fi
# 2. 清理过多库存
FINAL_COUNT=$(find "$CACHE_DIR" -maxdepth 1 -name "*.jpg" 2>/dev/null | wc -l)
if [ "$FINAL_COUNT" -gt "$MAX_CACHE_LIMIT" ]; then
DELETE_START_LINE=$((MAX_CACHE_LIMIT + 1))
ls -tp "$CACHE_DIR"/*.jpg 2>/dev/null | tail -n +$DELETE_START_LINE | xargs -I {} rm -- "{}"
fi
) 200>"$LOCK_FILE"
}
# --- 3. 主程序逻辑 ---
shopt -s nullglob
FILES=("$CACHE_DIR"/*.jpg)
NUM_FILES=${#FILES[@]}
shopt -u nullglob
SELECTED_IMG=""
if [ "$NUM_FILES" -gt 0 ]; then
# 有库存,随机选一张
RAND_INDEX=$(( RANDOM % NUM_FILES ))
SELECTED_IMG="${FILES[$RAND_INDEX]}"
# 后台补货
background_job >/dev/null 2>&1 &
else
# 没库存,提示语更改
echo "库存不够啦!正在去搬运新的图片,请稍等哦..."
download_one_image
shopt -s nullglob
FILES=("$CACHE_DIR"/*.jpg)
shopt -u nullglob
if [ ${#FILES[@]} -gt 0 ]; then
SELECTED_IMG="${FILES[0]}"
background_job >/dev/null 2>&1 &
fi
fi
# 运行 Fastfetch
if [ -n "$SELECTED_IMG" ] && [ -f "$SELECTED_IMG" ]; then
# 显示图片
fastfetch --logo "$SELECTED_IMG" --logo-preserve-aspect-ratio true "${ARGS_FOR_FASTFETCH[@]}"
# === 新增逻辑:移动到 used 目录 ===
mv "$SELECTED_IMG" "$USED_DIR/"
# === 新增逻辑:检查 used 目录数量并清理 ===
USED_COUNT=$(find "$USED_DIR" -maxdepth 1 -name "*.jpg" 2>/dev/null | wc -l)
if [ "$USED_COUNT" -gt "$MAX_USED_LIMIT" ]; then
# 计算需要保留的文件行数 (跳过最新的 MAX_USED_LIMIT 个)
SKIP_LINES=$((MAX_USED_LIMIT + 1))
# ls -tp 按时间倒序排列(新->旧)tail 取出旧文件xargs 删除
ls -tp "$USED_DIR"/*.jpg 2>/dev/null | tail -n +$SKIP_LINES | xargs -I {} rm -- "{}"
fi
# 检查是否开启清理 Fastfetch 内部缓存 (仅清理缩略图缓存,不删原图)
if [ "$CLEAN_CACHE_MODE" = true ]; then
rm -rf "$HOME/.cache/fastfetch/images"
fi
else
# 失败提示语更改
echo "呜呜... 图片下载失败了,这次只能先显示默认的 Logo 啦 QAQ"
fastfetch "${ARGS_FOR_FASTFETCH[@]}"
fi

View File

@ -0,0 +1,181 @@
"$schema" = 'https://starship.rs/config-schema.json'
format = """
[](color_orange)\
$os\
$username\
[](bg:color_yellow fg:color_orange)\
$directory\
[](fg:color_yellow bg:color_aqua)\
$git_branch\
$git_status\
[](fg:color_aqua bg:color_blue)\
$c\
$cpp\
$rust\
$golang\
$nodejs\
$php\
$java\
$kotlin\
$haskell\
$python\
[](fg:color_blue bg:color_bg3)\
$docker_context\
$conda\
$pixi\
[](fg:color_bg3 bg:color_bg1)\
$time\
[ ](fg:color_bg1)\
$line_break$character"""
palette = 'colors'
[palettes.colors]
mustard = '#af8700'
color_orange = '#96cdf8'
color_fg0 = '#00344e'
color_fg1 = '#e0e3e8'
color_purple = '#ebddff'
color_bg3 = '#b7c9d9'
color_green = '#00344e'
color_bg1 = '#384956'
color_blue = '#27638a'
color_red = '#96cdf8'
color_aqua = '#d3e5f5'
color_yellow = '#cfc0e8'
[os]
disabled = false
style = "bg:color_orange fg:color_fg0"
[os.symbols]
Windows = "󰍲"
Ubuntu = "󰕈"
SUSE = ""
Raspbian = "󰐿"
Mint = "󰣭"
Macos = "󰀵"
Manjaro = ""
Linux = "󰌽"
Gentoo = "󰣨"
Fedora = "󰣛"
Alpine = ""
Amazon = ""
Android = ""
Arch = "󰣇"
Artix = "󰣇"
EndeavourOS = ""
CentOS = ""
Debian = "󰣚"
Redhat = "󱄛"
RedHatEnterprise = "󱄛"
Pop = ""
[username]
show_always = true
style_user = "bg:color_orange fg:color_fg0"
style_root = "bg:color_orange fg:color_fg0"
format = '[ $user ]($style)'
[directory]
style = "fg:color_fg0 bg:color_yellow"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
[directory.substitutions]
"Documents" = "󰈙 "
"Downloads" = " "
"Music" = "󰝚 "
"Pictures" = " "
"Developer" = "󰲋 "
[git_branch]
symbol = ""
style = "bg:color_aqua"
format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)'
[git_status]
style = "bg:color_aqua"
format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)'
[nodejs]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[c]
symbol = " "
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[cpp]
symbol = " "
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[rust]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[golang]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[php]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[java]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[kotlin]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg1 bg:color_blue)]($style)'
[haskell]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[python]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[docker_context]
symbol = ""
style = "bg:color_bg3"
format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)'
[conda]
style = "bg:color_bg3"
format = '[[ $symbol( $environment) ](fg:#83a598 bg:color_bg3)]($style)'
[pixi]
style = "bg:color_bg3"
format = '[[ $symbol( $version)( $environment) ](fg:color_fg0 bg:color_bg3)]($style)'
[time]
disabled = false
time_format = "%R"
style = "bg:color_bg1"
format = '[[  $time ](fg:color_fg1 bg:color_bg1)]($style)'
[line_break]
disabled = false
[character]
disabled = false
success_symbol = '[](bold fg:color_green)'
error_symbol = '[](bold fg:color_red)'
vimcmd_symbol = '[](bold fg:color_green)'
vimcmd_replace_one_symbol = '[](bold fg:color_purple)'
vimcmd_replace_symbol = '[](bold fg:color_purple)'
vimcmd_visual_symbol = '[](bold fg:color_yellow)'

View File

@ -0,0 +1,10 @@
patch:
ascii_composer:
good_old_caps_lock: true
schema_list:
- schema: rime_ice
- schema: luna_pinyin_simp
- schema: double_pinyin_flypy
- schema: wubi86
- schema: bopomofo
"menu/page_size": 6

35
gnome-dotfiles/.vimrc Normal file
View File

@ -0,0 +1,35 @@
"显示行号
set number
"显示相对行号
set relativenumber
"高亮当前行
set cursorline
"语法高亮
syntax on
" 开启自动缩进,新的一行会自动与上一行对齐
set autoindent
" 在输入搜索词时,实时高亮显示匹配项(增量搜索)
set incsearch
" 高亮显示所有搜索结果
set hlsearch
" 搜索时忽略大小写
set ignorecase
" 如果搜索词中包含了大写字母,则自动切换为大小写敏感搜索
set smartcase
" 开启持久化撤销undo即使关闭再打开文件也能撤销之前的更改
set undofile
" undo目录
silent !mkdir -p ~/.cache/vim/undo
set undodir=~/.cache/vim/undo
" 剪贴板 gvim的功能
set clipboard=unnamedplus
" 接管鼠标事件
set mouse=a