feat: cfg load

This commit is contained in:
Megnas 2026-02-22 17:36:30 +01:00
parent 148c8938e9
commit 22e6573f27
2 changed files with 38 additions and 1 deletions

View File

@ -27,10 +27,12 @@ exec-once = swaync &
exec-once = waybar & hyprpaper
exec-once = hypridle
exec-once = copyq --start-server
#Autostart programs
exec-once = discord --start-minimized
exec-once = steam -silent
exec-once = thunar --daemon
#exec-once = thunar --daemon
#exec-once = hyprpm reload -n
#############################

View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET="$HOME/.saved_cfg"
FOLDERS_FILE="$TARGET/folders"
if [[ ! -f "$FOLDERS_FILE" ]]; then
echo "Error: $FOLDERS_FILE not found"
exit 1
fi
while IFS= read -r line || [[ -n "$line" ]]; do
# Trim whitespace
folder="$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
# Skip empty lines and comments
[[ -z "$folder" || "$folder" =~ ^# ]] && continue
SRC_PATH="$TARGET/$folder"
DEST_PATH="$HOME/$folder"
if [[ -d "$SRC_PATH" ]]; then
echo "Restoring $SRC_PATH -> $DEST_PATH"
mkdir -p "$DEST_PATH"
rsync -av --delete --backup --backup-dir="$HOME/.cfg_restore_backup_$(date +%F_%T)" \
--exclude='.git/' \
"$SRC_PATH/" "$DEST_PATH/"
else
echo "Skipping $SRC_PATH (not found)"
fi
done < "$FOLDERS_FILE"
echo "Restore complete."