From 7d89d2547c00a32f102292f31e2fa1ad89b5461b Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 22 Feb 2025 02:09:23 +0900 Subject: improved copy.sh. Will restore previous waybar styles and layouts --- copy.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 97240e2b..ddac1208 100755 --- a/copy.sh +++ b/copy.sh @@ -493,7 +493,10 @@ for DIR2 in $DIRS; do # restoring waybar config and style automatically if [ "$DIR2" = "waybar" ]; then - cp "$DIRPATH-backup-$BACKUP_DIR/config" ~/.config/waybar/ && cp "$DIRPATH-backup-$BACKUP_DIR/style.css" ~/.config/waybar/ + rm -f "$HOME/.config/waybar/config" "$HOME/.config/waybar/style.css" || true + cp -L "$DIRPATH-backup-$BACKUP_DIR/config" "$HOME/.config/waybar/config" || true + cp -L "$DIRPATH-backup-$BACKUP_DIR/style.css" "$HOME/.config/waybar/style.css" || true + echo -e "${OK} - waybar config and style restored automatically" 2>&1 | tee -a "$LOG" fi break @@ -768,7 +771,10 @@ else config_remove="" fi -ln -sf "$config_file" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" || true +# Check if ~/.config/waybar/config is a symlink +if [ -L "$HOME/.config/waybar/config" ]; then + ln -sf "$config_file" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" +fi # Remove inappropriate waybar configs rm -rf "$HOME/.config/waybar/configs/[TOP] Default$config_remove" \ @@ -900,8 +906,10 @@ cleanup_backups() { # Execute the cleanup function cleanup_backups -# symlinks for waybar style -ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" && \ +# Check if ~/.config/waybar/style is a symlink +if [ -L "$HOME/.config/waybar/style.css" ]; then + ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" 2>&1 | tee -a "$LOG" +fi printf "\n%.0s" {1..1} -- cgit v1.2.3