Files
niri-beyond-glass/uninstall.sh
T

33 lines
989 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
config_home="${XDG_CONFIG_HOME:-$HOME/.config}"
state_home="${XDG_STATE_HOME:-$HOME/.local/state}"
backup_root="$state_home/niri-beyond-glass/backups"
original_root="$state_home/niri-beyond-glass/original"
latest=""
if [[ -e "$original_root/.captured" ]]; then
latest="$original_root"
elif [[ -d "$backup_root" ]]; then
latest="$(find "$backup_root" -mindepth 1 -maxdepth 1 -type d -printf '%p\n' | sort | tail -n 1)"
fi
rm -rf \
"$config_home/niri" \
"$config_home/waybar" \
"$config_home/fuzzel" \
"$config_home/mako" \
"$config_home/swaylock" \
"$config_home/niri-beyond-glass"
rm -f "$HOME/.local/bin/niri-beyond-wallpaper"
if [[ -n "$latest" && -d "$latest/config" ]]; then
cp -a "$latest/config/." "$config_home/"
printf '已恢复备份:%s\n' "$latest"
else
printf '配置已移除;没有找到可恢复的备份。\n'
fi
printf 'Niri 和系统软件包被保留。GNOME/GDM 未修改。\n'