52 lines
1.7 KiB
Bash
Executable File
52 lines
1.7 KiB
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=""
|
|
profile="$state_home/niri-beyond-glass/nix-profile"
|
|
|
|
systemctl --user disable --now dms.service 2>/dev/null || true
|
|
|
|
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" \
|
|
"$config_home/DankMaterialShell" \
|
|
"$config_home/alacritty"
|
|
rm -f "$config_home/systemd/user/dms.service"
|
|
rm -rf "$state_home/DankMaterialShell"
|
|
|
|
for binary in dms quickshell qs matugen dgop dsearch; do
|
|
link="$HOME/.local/bin/$binary"
|
|
if [[ -L "$link" && "$(readlink "$link")" == "$profile/"* ]]; then
|
|
rm -f "$link"
|
|
fi
|
|
done
|
|
rm -f \
|
|
"$HOME/.local/bin/niri-beyond-wallpaper" \
|
|
"$HOME/.local/bin/niri-beyond-browser" \
|
|
"$HOME/.local/bin/niri-beyond-refresh"
|
|
rm -f "$state_home/niri-beyond-glass"/nix-profile*
|
|
|
|
if [[ -n "$latest" && -d "$latest/config" ]]; then
|
|
cp -a "$latest/config/." "$config_home/"
|
|
printf '已恢复备份:%s\n' "$latest"
|
|
else
|
|
printf '配置已移除;没有找到可恢复的备份。\n'
|
|
fi
|
|
|
|
systemctl --user daemon-reload 2>/dev/null || true
|
|
printf '已移除项目专用 DMS 运行层。Niri 和系统软件包被保留,GNOME/GDM 未修改。\n'
|