From 4e622c1766d19737098b28f1a74c7a79cafcbf9e Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 23 Feb 2025 09:35:18 +0900 Subject: updated copy.sh --- copy.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/copy.sh b/copy.sh index 7e2dfb75..d22d0fce 100755 --- a/copy.sh +++ b/copy.sh @@ -498,21 +498,36 @@ for DIR2 in $DIRS; do # Restoring waybar config and style automatically if [ "$DIR2" = "waybar" ]; then + # Remove existing symlinks first before copying. rm -rf "$HOME/.config/waybar/config" "$HOME/.config/waybar/style.css" + # Copy the temp files (config_2 and style.css_2) from the backup and restore them cp "$DIRPATH-backup-$BACKUP_DIR/config_2" "$HOME/.config/waybar/config" || true cp "$DIRPATH-backup-$BACKUP_DIR/style.css_2" "$HOME/.config/waybar/style.css" || true - find "$DIRPATH-backup-$BACKUP_DIR/configs" -type f -exec cp -n "{}" "$HOME/.config/waybar/configs/" \; || true - find "$DIRPATH-backup-$BACKUP_DIR/style" -type f -exec cp -n "{}" "$HOME/.config/waybar/style/" \; || true - - echo -e "${OK} - Unique waybar configs and styles restored automatically" 2>&1 | tee -a "$LOG" + echo -e "${OK} - previous waybar configs and styles restored automatically" 2>&1 | tee -a "$LOG" + + # Optionally restore other waybar configuration and style files if present + find "$DIRPATH-backup-$BACKUP_DIR/configs" -type f -exec sh -c ' + echo "Copying {} to $HOME/.config/waybar/configs/" >> "$LOG" + cp -n "{}" "$HOME/.config/waybar/configs/" + ' \; || true + + find "$DIRPATH-backup-$BACKUP_DIR/style" -type f -exec sh -c ' + echo "Copying {} to $HOME/.config/waybar/style/" >> "$LOG" + cp -n "{}" "$HOME/.config/waybar/style/" + ' \; || true fi + - # Restoring rofi themes - if [ "$DIR2" = "rofi" ]; then - find "$DIRPATH-backup-$BACKUP_DIR/themes" -type f -exec cp -n "{}" "$HOME/.config/rofi/themes/" \; || true - echo -e "${OK} - Unique rofi themes restored automatically" 2>&1 | tee -a "$LOG" + # Restoring rofi themes directory unique themes + if [ "$DIR2" = "rofi" ]; then + if [ -d "$DIRPATH-backup-$BACKUP_DIR/themes" ]; then + find "$DIRPATH-backup-$BACKUP_DIR/themes" -type f -exec sh -c ' + echo "Copying {} to $HOME/.config/rofi/themes/" >> "$LOG" + cp -n "{}" "$HOME/.config/rofi/themes/" + ' \; || true + fi fi break -- cgit v1.2.3