aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2026-01-11 21:13:07 -0500
committerDon Williams <don.e.williams@gmail.com>2026-01-11 21:13:07 -0500
commita7c359e377d6daed4af9158ea0cc915d804ea359 (patch)
tree888388d3ebde6e440369b80a6b487ad9cf9e6024
parent050121695a344e95ac4181e079c45e898c3dcda6 (diff)
Moved UserScripts/UserConfigs restore function to lib_copy helper
copy.sh is nearly 50% smaller now a little over 600 lines now down from over 1200 at the start On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: copy.sh modified: scripts/lib_copy.sh
-rwxr-xr-xcopy.sh256
-rw-r--r--scripts/lib_copy.sh243
2 files changed, 248 insertions, 251 deletions
diff --git a/copy.sh b/copy.sh
index 398f72d0..c36e73e9 100755
--- a/copy.sh
+++ b/copy.sh
@@ -462,263 +462,17 @@ if command -v qs >/dev/null 2>&1; then
fi
printf "\n%.0s" {1..1}
-# Restore automatically Animations and Monitor-Profiles
-# including monitors.conf and workspaces.conf
-HYPR_DIR="$HOME/.config/hypr"
-BACKUP_DIR=$(get_backup_dirname)
-BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR"
-
-if [ -d "$BACKUP_HYPR_PATH" ]; then
- if [ "$EXPRESS_MODE" -eq 1 ]; then
- echo "${NOTE} Express mode: skipping automatic restoration of animations and monitor profiles." 2>&1 | tee -a "$LOG"
- else
- echo -e "\n${NOTE} Restoring ${SKY_BLUE}Animations & Monitor Profiles${RESET} directories into ${YELLOW}$HYPR_DIR${RESET}..."
-
- DIR_B=("Monitor_Profiles" "animations" "wallpaper_effects")
- # Restore directories automatically
- for DIR_RESTORE in "${DIR_B[@]}"; do
- BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE"
- if [ -d "$BACKUP_SUBDIR" ]; then
- cp -r "$BACKUP_SUBDIR" "$HYPR_DIR/"
- echo "${OK} - Restored directory: ${MAGENTA}$DIR_RESTORE${RESET}" 2>&1 | tee -a "$LOG"
- fi
- done
-
- # Restore files automatically
- FILE_B=("monitors.conf" "workspaces.conf")
- for FILE_RESTORE in "${FILE_B[@]}"; do
- BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE"
-
- if [ -f "$BACKUP_FILE" ]; then
- cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE"
- echo "${OK} - Restored file: ${MAGENTA}$FILE_RESTORE${RESET}" 2>&1 | tee -a "$LOG"
- fi
- done
- fi
-fi
-
+restore_hypr_assets "$LOG" "$EXPRESS_MODE"
printf "\n%.0s" {1..1}
-# Restoring UserConfigs and UserScripts
-# Helper to extract overlay (additions) and optional disables from a previous user file compared to vendor base
-compose_overlay_from_backup() {
- local type="$1" # startup|windowrules
- local base_file="$2"
- local old_user_file="$3"
- local new_user_file="$4"
- local disable_file="$5"
-
- mkdir -p "$(dirname "$new_user_file")"
- : >"$new_user_file"
- : >"$disable_file"
-
- if [ "$type" = "startup" ]; then
- # additions: exec-once lines present in old user but not in base
- grep -E '^\s*exec-once\s*=' "$old_user_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$old_user_file.tmp.exec"
- grep -E '^\s*exec-once\s*=' "$base_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$base_file.tmp.exec"
- comm -23 "$old_user_file.tmp.exec" "$base_file.tmp.exec" >"$new_user_file"
- # treat commented exec-once in old user as disables
- grep -E '^\s*#\s*exec-once\s*=' "$old_user_file" |
- sed -E 's/^\s*#\s*exec-once\s*=\s*//' |
- sed -E 's/^\s+//;s/\s+$//' |
- grep -Ev '^\$scriptsDir/KeybindsLayoutInit\.sh$' |
- sort -u >"$disable_file"
- rm -f "$old_user_file.tmp.exec" "$base_file.tmp.exec"
- elif [ "$type" = "windowrules" ]; then
- # additions
- grep -E '^(windowrule|layerrule)\s*=' "$old_user_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$old_user_file.tmp.rules"
- grep -E '^(windowrule|layerrule)\s*=' "$base_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$base_file.tmp.rules"
- comm -23 "$old_user_file.tmp.rules" "$base_file.tmp.rules" >"$new_user_file"
- # disables: lines commented in old user
- grep -E '^\s*#\s*(windowrule|layerrule)\s*=' "$old_user_file" | sed -E 's/^\s*#\s*//' | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$disable_file"
- rm -f "$old_user_file.tmp.rules" "$base_file.tmp.rules"
- fi
-}
-
-
-DIRH="hypr"
-DIRPATH="$HOME/.config/$DIRH"
-BACKUP_DIR=$(get_backup_dirname)
-BACKUP_DIR_PATH="$DIRPATH-backup-$BACKUP_DIR/UserConfigs"
-
-if [ -z "$BACKUP_DIR" ]; then
- echo "${ERROR} - Backup directory name is empty. Exiting."
- exit 1
-fi
-
-if [ -d "$BACKUP_DIR_PATH" ] && [ "$EXPRESS_MODE" -eq 1 ]; then
- echo "${NOTE} Express mode: skipping UserConfigs restoration prompts." 2>&1 | tee -a "$LOG"
-fi
-
-if [ -d "$BACKUP_DIR_PATH" ] && [ "$EXPRESS_MODE" -eq 0 ]; then
- # Detect version
- VERSION_FILE=$(find "$DIRPATH" -maxdepth 1 -name "v*.*.*" | head -n 1)
- CURRENT_VERSION="999.9.9"
- if [ -n "$VERSION_FILE" ]; then
- CURRENT_VERSION=$(basename "$VERSION_FILE" | sed 's/^v//')
- fi
-
- TARGET_VERSION="2.3.19"
-
- echo -e "${NOTE} Restoring previous ${MAGENTA}User-Configs${RESET}... "
- print_color $WARNING "
- █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
- NOTES for RESTORING PREVIOUS CONFIGS
- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
-
- The 'UserConfigs' directory is for all your personal settings.
- Files in this directory will override the default configurations,
- so your customizations are not lost when you update.
- "
-
- if version_gte "$CURRENT_VERSION" "$TARGET_VERSION"; then
- # NEW BEHAVIOR (>= 2.3.19) - Bulk Restore
- echo -n "${CAT} Do you want to restore your previous UserConfigs directory? (Y/n): "
- read -r restore_userconfigs_dir
-
- if [[ "$restore_userconfigs_dir" != [Nn]* ]]; then
- echo "${NOTE} Restoring UserConfigs directory..." 2>&1 | tee -a "$LOG"
- # Use rsync to copy contents, overwriting existing files.
- rsync -a "$BACKUP_DIR_PATH/" "$DIRPATH/UserConfigs/" 2>&1 | tee -a "$LOG"
- echo "${OK} - UserConfigs directory restored." 2>&1 | tee -a "$LOG"
- else
- echo "${NOTE} - Skipped restoring UserConfigs." 2>&1 | tee -a "$LOG"
- fi
-
- else
- # OLD BEHAVIOR (<= 2.3.18) - Selective Restore
- echo -e "${NOTE} Detected version ${YELLOW}v$CURRENT_VERSION${RESET} (older than v$TARGET_VERSION). Using legacy restoration mode."
-
- FILES_TO_RESTORE=(
- "01-UserDefaults.conf"
- "ENVariables.conf"
- "LaptopDisplay.conf"
- "Laptops.conf"
- "Startup_Apps.conf"
- "UserDecorations.conf"
- "UserAnimations.conf"
- "UserKeybinds.conf"
- "UserSettings.conf"
- "WindowRules.conf"
- )
-
- for FILE_NAME in "${FILES_TO_RESTORE[@]}"; do
- BACKUP_FILE="$BACKUP_DIR_PATH/$FILE_NAME"
- if [ -f "$BACKUP_FILE" ]; then
- # Special handling for Startup_Apps.conf and WindowRules.conf
- if [ "$FILE_NAME" = "Startup_Apps.conf" ]; then
- compose_overlay_from_backup "startup" "$DIRPATH/configs/Startup_Apps.conf" "$BACKUP_FILE" "$DIRPATH/UserConfigs/Startup_Apps.conf" "$DIRPATH/UserConfigs/Startup_Apps.disable"
- echo "${OK} - Migrated overlay for ${YELLOW}$FILE_NAME${RESET}" 2>&1 | tee -a "$LOG"
- continue
- fi
- if [ "$FILE_NAME" = "WindowRules.conf" ]; then
- compose_overlay_from_backup "windowrules" "$DIRPATH/configs/WindowRules.conf" "$BACKUP_FILE" "$DIRPATH/UserConfigs/WindowRules.conf" "$DIRPATH/UserConfigs/WindowRules.disable"
- echo "${OK} - Migrated overlay for ${YELLOW}$FILE_NAME${RESET}" 2>&1 | tee -a "$LOG"
- continue
- fi
-
- printf "\n${INFO} Found ${YELLOW}$FILE_NAME${RESET} in hypr backup...\n"
- echo -n "${CAT} Do you want to restore ${YELLOW}$FILE_NAME${RESET} from backup? (Y/n): "
- read file_restore
-
- if [[ "$file_restore" != [Nn]* ]]; then
- if cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME"; then
- echo "${OK} - $FILE_NAME restored!" 2>&1 | tee -a "$LOG"
- else
- echo "${ERROR} - Failed to restore $FILE_NAME!" 2>&1 | tee -a "$LOG"
- fi
- else
- echo "${NOTE} - Skipped restoring $FILE_NAME." 2>&1 | tee -a "$LOG"
- fi
- fi
- done
- fi
-fi
-
+restore_user_configs "$LOG" "$EXPRESS_MODE"
printf "\n%.0s" {1..1}
-# Restoring previous UserScripts
-DIRSH="hypr"
-SCRIPTS_TO_RESTORE=(
- "RofiBeats.sh"
- "Weather.py"
- "Weather.sh"
-)
-
-DIRSHPATH="$HOME/.config/$DIRSH"
-BACKUP_DIR_PATH_S="$DIRSHPATH-backup-$BACKUP_DIR/UserScripts"
-
-if [ -d "$BACKUP_DIR_PATH_S" ] && [ "$EXPRESS_MODE" -eq 1 ]; then
- echo "${NOTE} Express mode: skipping UserScripts restoration prompts." 2>&1 | tee -a "$LOG"
-fi
-
-if [ -d "$BACKUP_DIR_PATH_S" ] && [ "$EXPRESS_MODE" -eq 0 ]; then
- echo -e "${NOTE} Restoring previous ${MAGENTA}User-Scripts${RESET}..."
-
- for SCRIPT_NAME in "${SCRIPTS_TO_RESTORE[@]}"; do
- BACKUP_SCRIPT="$BACKUP_DIR_PATH_S/$SCRIPT_NAME"
-
- if [ -f "$BACKUP_SCRIPT" ]; then
- printf "\n${INFO} Found ${YELLOW}$SCRIPT_NAME${RESET} in hypr backup...\n"
- echo -n "${CAT} Do you want to restore ${YELLOW}$SCRIPT_NAME${RESET} from backup? (y/N): "
- read script_restore
-
- if [[ "$script_restore" == [Yy]* ]]; then
- if cp "$BACKUP_SCRIPT" "$DIRSHPATH/UserScripts/$SCRIPT_NAME"; then
- echo "${OK} - $SCRIPT_NAME restored!" 2>&1 | tee -a "$LOG"
- else
- echo "${ERROR} - Failed to restore $SCRIPT_NAME!" 2>&1 | tee -a "$LOG"
- fi
- else
- echo "${NOTE} - Skipped restoring $SCRIPT_NAME." 2>&1 | tee -a "$LOG"
- fi
- fi
- done
-fi
-
+restore_user_scripts "$LOG" "$EXPRESS_MODE"
printf "\n%.0s" {1..1}
-# restoring some files in ~/.config/hypr
-DIR_H="hypr"
-FILES_2_RESTORE=(
- "hyprlock.conf"
- "hypridle.conf"
-)
-
-DIRPATH="$HOME/.config/$DIR_H"
-BACKUP_DIR=$(get_backup_dirname)
-BACKUP_DIR_PATH_F="$DIRPATH-backup-$BACKUP_DIR"
-
-if [ -d "$BACKUP_DIR_PATH_F" ] && [ "$EXPRESS_MODE" -eq 1 ]; then
- echo "${NOTE} Express mode: skipping individual hypr file restoration prompts." 2>&1 | tee -a "$LOG"
-fi
-
-if [ -d "$BACKUP_DIR_PATH_F" ] && [ "$EXPRESS_MODE" -eq 0 ]; then
- echo -e "${NOTE} Restoring some files in ${MAGENTA}$HOME/.config/hypr directory${RESET}..."
-
- for FILE_RESTORE in "${FILES_2_RESTORE[@]}"; do
- BACKUP_FILE="$BACKUP_DIR_PATH_F/$FILE_RESTORE"
-
- if [ -f "$BACKUP_FILE" ]; then
- echo -e "\n${INFO} Found ${YELLOW}$FILE_RESTORE${RESET} in hypr backup..."
- echo -n "${CAT} Do you want to restore ${YELLOW}$FILE_RESTORE${RESET} from backup? (y/N): "
- read file2restore
-
- if [[ "$file2restore" == [Yy]* ]]; then
- if cp "$BACKUP_FILE" "$DIRPATH/$FILE_RESTORE"; then
- echo "${OK} - $FILE_RESTORE restored!" 2>&1 | tee -a "$LOG"
- else
- echo "${ERROR} - Failed to restore $FILE_RESTORE!" 2>&1 | tee -a "$LOG"
- fi
- else
- echo "${NOTE} - Skipped restoring $FILE_RESTORE." 2>&1 | tee -a "$LOG"
- fi
- else
- echo "${ERROR} - Backup file $BACKUP_FILE does not exist."
- fi
- done
-fi
-
+restore_hypr_files "$LOG" "$EXPRESS_MODE"
+printf "\n%.0s" {1..1}
printf "\n%.0s" {1..1}
# Define the target directory for rofi themes
diff --git a/scripts/lib_copy.sh b/scripts/lib_copy.sh
index 7d76cfc4..fa1231c5 100644
--- a/scripts/lib_copy.sh
+++ b/scripts/lib_copy.sh
@@ -117,3 +117,246 @@ copy_phase2() {
done
install_terminal_configs "$log"
}
+
+# Restore Animations and Monitor Profiles plus key hypr files from backup
+restore_hypr_assets() {
+ local log="$1"
+ local express_mode="$2"
+
+ local HYPR_DIR="$HOME/.config/hypr"
+ local BACKUP_DIR
+ BACKUP_DIR=$(get_backup_dirname)
+ local BACKUP_HYPR_PATH="$HYPR_DIR-backup-$BACKUP_DIR"
+
+ if [ -d "$BACKUP_HYPR_PATH" ]; then
+ if [ "$express_mode" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Express mode: skipping automatic restoration of animations and monitor profiles." 2>&1 | tee -a "$log"
+ return
+ fi
+
+ echo -e "\n${NOTE:-[NOTE]} Restoring ${SKY_BLUE:-}Animations & Monitor Profiles${RESET:-} into ${YELLOW:-}$HYPR_DIR${RESET:-}..."
+
+ local DIR_B=("Monitor_Profiles" "animations" "wallpaper_effects")
+ for DIR_RESTORE in "${DIR_B[@]}"; do
+ local BACKUP_SUBDIR="$BACKUP_HYPR_PATH/$DIR_RESTORE"
+ if [ -d "$BACKUP_SUBDIR" ]; then
+ cp -r "$BACKUP_SUBDIR" "$HYPR_DIR/" 2>&1 | tee -a "$log"
+ echo "${OK:-[OK]} - Restored directory: ${MAGENTA:-}$DIR_RESTORE${RESET:-}" 2>&1 | tee -a "$log"
+ fi
+ done
+
+ local FILE_B=("monitors.conf" "workspaces.conf")
+ for FILE_RESTORE in "${FILE_B[@]}"; do
+ local BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE"
+ if [ -f "$BACKUP_FILE" ]; then
+ cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" 2>&1 | tee -a "$log"
+ echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}$FILE_RESTORE${RESET:-}" 2>&1 | tee -a "$log"
+ fi
+ done
+ fi
+}
+
+# Helper to extract overlay additions/disables from previous user file vs base
+compose_overlay_from_backup() {
+ local type="$1" # startup|windowrules
+ local base_file="$2"
+ local old_user_file="$3"
+ local new_user_file="$4"
+ local disable_file="$5"
+
+ mkdir -p "$(dirname "$new_user_file")"
+ : >"$new_user_file"
+ : >"$disable_file"
+
+ if [ "$type" = "startup" ]; then
+ grep -E '^\s*exec-once\s*=' "$old_user_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$old_user_file.tmp.exec"
+ grep -E '^\s*exec-once\s*=' "$base_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$base_file.tmp.exec"
+ comm -23 "$old_user_file.tmp.exec" "$base_file.tmp.exec" >"$new_user_file"
+ grep -E '^\s*#\s*exec-once\s*=' "$old_user_file" |
+ sed -E 's/^\s*#\s*exec-once\s*=\s*//' |
+ sed -E 's/^\s+//;s/\s+$//' |
+ grep -Ev '^\$scriptsDir/KeybindsLayoutInit\.sh$' |
+ sort -u >"$disable_file"
+ rm -f "$old_user_file.tmp.exec" "$base_file.tmp.exec"
+ elif [ "$type" = "windowrules" ]; then
+ grep -E '^(windowrule|layerrule)\s*=' "$old_user_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$old_user_file.tmp.rules"
+ grep -E '^(windowrule|layerrule)\s*=' "$base_file" | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$base_file.tmp.rules"
+ comm -23 "$old_user_file.tmp.rules" "$base_file.tmp.rules" >"$new_user_file"
+ grep -E '^\s*#\s*(windowrule|layerrule)\s*=' "$old_user_file" | sed -E 's/^\s*#\s*//' | sed -E 's/^\s+//;s/\s+$//' | sort -u >"$disable_file"
+ rm -f "$old_user_file.tmp.rules" "$base_file.tmp.rules"
+ fi
+}
+
+restore_user_configs() {
+ local log="$1"
+ local express_mode="$2"
+
+ local DIRPATH="$HOME/.config/hypr"
+ local BACKUP_DIR
+ BACKUP_DIR=$(get_backup_dirname)
+ local BACKUP_DIR_PATH="$DIRPATH-backup-$BACKUP_DIR/UserConfigs"
+
+ if [ -z "$BACKUP_DIR" ]; then
+ echo "${ERROR:-[ERROR]} - Backup directory name is empty. Exiting." 2>&1 | tee -a "$log"
+ exit 1
+ fi
+
+ if [ -d "$BACKUP_DIR_PATH" ] && [ "$express_mode" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Express mode: skipping UserConfigs restoration prompts." 2>&1 | tee -a "$log"
+ return
+ fi
+
+ if [ -d "$BACKUP_DIR_PATH" ] && [ "$express_mode" -eq 0 ]; then
+ local VERSION_FILE
+ VERSION_FILE=$(find "$DIRPATH" -maxdepth 1 -name "v*.*.*" | head -n 1)
+ local CURRENT_VERSION="999.9.9"
+ if [ -n "$VERSION_FILE" ]; then
+ CURRENT_VERSION=$(basename "$VERSION_FILE" | sed 's/^v//')
+ fi
+
+ local TARGET_VERSION="2.3.19"
+
+ echo -e "${NOTE:-[NOTE]} Restoring previous ${MAGENTA:-}User-Configs${RESET:-}... " 2>&1 | tee -a "$log"
+ printf "${WARNING:-}\
+ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\n\
+ NOTES for RESTORING PREVIOUS CONFIGS\n\
+ █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█\n\n\
+ The 'UserConfigs' directory is for all your personal settings.\n\
+ Files in this directory will override the default configurations,\n\
+ so your customizations are not lost when you update.\n\
+" >&2
+
+ if version_gte "$CURRENT_VERSION" "$TARGET_VERSION"; then
+ read -r -p "${CAT:-[ACTION]} Do you want to restore your previous UserConfigs directory? (Y/n): " restore_userconfigs_dir
+ if [[ "$restore_userconfigs_dir" != [Nn]* ]]; then
+ echo "${NOTE:-[NOTE]} Restoring UserConfigs directory..." 2>&1 | tee -a "$log"
+ rsync -a "$BACKUP_DIR_PATH/" "$DIRPATH/UserConfigs/" 2>&1 | tee -a "$log"
+ echo "${OK:-[OK]} - UserConfigs directory restored." 2>&1 | tee -a "$log"
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring UserConfigs." 2>&1 | tee -a "$log"
+ fi
+ else
+ echo -e "${NOTE:-[NOTE]} Detected version ${YELLOW:-}v$CURRENT_VERSION${RESET:-} (older than v$TARGET_VERSION). Using legacy restoration mode." 2>&1 | tee -a "$log"
+
+ local FILES_TO_RESTORE=(
+ "01-UserDefaults.conf"
+ "ENVariables.conf"
+ "LaptopDisplay.conf"
+ "Laptops.conf"
+ "Startup_Apps.conf"
+ "UserDecorations.conf"
+ "UserAnimations.conf"
+ "UserKeybinds.conf"
+ "UserSettings.conf"
+ "WindowRules.conf"
+ )
+
+ for FILE_NAME in "${FILES_TO_RESTORE[@]}"; do
+ local BACKUP_FILE="$BACKUP_DIR_PATH/$FILE_NAME"
+ if [ -f "$BACKUP_FILE" ]; then
+ if [ "$FILE_NAME" = "Startup_Apps.conf" ]; then
+ compose_overlay_from_backup "startup" "$DIRPATH/configs/Startup_Apps.conf" "$BACKUP_FILE" "$DIRPATH/UserConfigs/Startup_Apps.conf" "$DIRPATH/UserConfigs/Startup_Apps.disable"
+ echo "${OK:-[OK]} - Migrated overlay for ${YELLOW:-}$FILE_NAME${RESET:-}" 2>&1 | tee -a "$log"
+ continue
+ fi
+ if [ "$FILE_NAME" = "WindowRules.conf" ]; then
+ compose_overlay_from_backup "windowrules" "$DIRPATH/configs/WindowRules.conf" "$BACKUP_FILE" "$DIRPATH/UserConfigs/WindowRules.conf" "$DIRPATH/UserConfigs/WindowRules.disable"
+ echo "${OK:-[OK]} - Migrated overlay for ${YELLOW:-}$FILE_NAME${RESET:-}" 2>&1 | tee -a "$log"
+ continue
+ fi
+
+ printf "\n${INFO:-[INFO]} Found ${YELLOW:-}$FILE_NAME${RESET:-} in hypr backup...\n"
+ read -r -p "${CAT:-[ACTION]} Do you want to restore ${YELLOW:-}$FILE_NAME${RESET:-} from backup? (Y/n): " file_restore
+
+ if [[ "$file_restore" != [Nn]* ]]; then
+ if cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME"; then
+ echo "${OK:-[OK]} - $FILE_NAME restored!" 2>&1 | tee -a "$log"
+ else
+ echo "${ERROR:-[ERROR]} - Failed to restore $FILE_NAME!" 2>&1 | tee -a "$log"
+ fi
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring $FILE_NAME." 2>&1 | tee -a "$log"
+ fi
+ fi
+ done
+ fi
+ fi
+}
+
+restore_user_scripts() {
+ local log="$1"
+ local express_mode="$2"
+
+ local DIRSHPATH="$HOME/.config/hypr"
+ local BACKUP_DIR
+ BACKUP_DIR=$(get_backup_dirname)
+ local BACKUP_DIR_PATH_S="$DIRSHPATH-backup-$BACKUP_DIR/UserScripts"
+ local SCRIPTS_TO_RESTORE=("RofiBeats.sh" "Weather.py" "Weather.sh")
+
+ if [ -d "$BACKUP_DIR_PATH_S" ] && [ "$express_mode" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Express mode: skipping UserScripts restoration prompts." 2>&1 | tee -a "$log"
+ return
+ fi
+
+ if [ -d "$BACKUP_DIR_PATH_S" ] && [ "$express_mode" -eq 0 ]; then
+ echo -e "${NOTE:-[NOTE]} Restoring previous ${MAGENTA:-}User-Scripts${RESET:-}..." 2>&1 | tee -a "$log"
+
+ for SCRIPT_NAME in "${SCRIPTS_TO_RESTORE[@]}"; do
+ local BACKUP_SCRIPT="$BACKUP_DIR_PATH_S/$SCRIPT_NAME"
+ if [ -f "$BACKUP_SCRIPT" ]; then
+ printf "\n${INFO:-[INFO]} Found ${YELLOW:-}$SCRIPT_NAME${RESET:-} in hypr backup...\n"
+ read -r -p "${CAT:-[ACTION]} Do you want to restore ${YELLOW:-}$SCRIPT_NAME${RESET:-} from backup? (y/N): " script_restore
+
+ if [[ "$script_restore" == [Yy]* ]]; then
+ if cp "$BACKUP_SCRIPT" "$DIRSHPATH/UserScripts/$SCRIPT_NAME"; then
+ echo "${OK:-[OK]} - $SCRIPT_NAME restored!" 2>&1 | tee -a "$log"
+ else
+ echo "${ERROR:-[ERROR]} - Failed to restore $SCRIPT_NAME!" 2>&1 | tee -a "$log"
+ fi
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring $SCRIPT_NAME." 2>&1 | tee -a "$log"
+ fi
+ fi
+ done
+ fi
+}
+
+restore_hypr_files() {
+ local log="$1"
+ local express_mode="$2"
+
+ local DIRPATH="$HOME/.config/hypr"
+ local BACKUP_DIR
+ BACKUP_DIR=$(get_backup_dirname)
+ local BACKUP_DIR_PATH_F="$DIRPATH-backup-$BACKUP_DIR"
+ local FILES_2_RESTORE=("hyprlock.conf" "hypridle.conf")
+
+ if [ -d "$BACKUP_DIR_PATH_F" ] && [ "$express_mode" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Express mode: skipping individual hypr file restoration prompts." 2>&1 | tee -a "$log"
+ return
+ fi
+
+ if [ -d "$BACKUP_DIR_PATH_F" ] && [ "$express_mode" -eq 0 ]; then
+ echo -e "${NOTE:-[NOTE]} Restoring some files in ${MAGENTA:-}$HOME/.config/hypr directory${RESET:-}..." 2>&1 | tee -a "$log"
+
+ for FILE_RESTORE in "${FILES_2_RESTORE[@]}"; do
+ local BACKUP_FILE="$BACKUP_DIR_PATH_F/$FILE_RESTORE"
+ if [ -f "$BACKUP_FILE" ]; then
+ echo -e "\n${INFO:-[INFO]} Found ${YELLOW:-}$FILE_RESTORE${RESET:-} in hypr backup..."
+ read -r -p "${CAT:-[ACTION]} Do you want to restore ${YELLOW:-}$FILE_RESTORE${RESET:-} from backup? (y/N): " file2restore
+
+ if [[ "$file2restore" == [Yy]* ]]; then
+ if cp "$BACKUP_FILE" "$DIRPATH/$FILE_RESTORE"; then
+ echo "${OK:-[OK]} - $FILE_RESTORE restored!" 2>&1 | tee -a "$log"
+ else
+ echo "${ERROR:-[ERROR]} - Failed to restore $FILE_RESTORE!" 2>&1 | tee -a "$log"
+ fi
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring $FILE_RESTORE." 2>&1 | tee -a "$log"
+ fi
+ else
+ echo "${ERROR:-[ERROR]} - Backup file $BACKUP_FILE does not exist." 2>&1 | tee -a "$log"
+ fi
+ done
+ fi
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage