From fa4c93ed241a80571e2ea8efc4213542b4d494fb Mon Sep 17 00:00:00 2001 From: Don Williams Date: Wed, 22 Jul 2026 13:05:21 -0400 Subject: Fix kitty cfg restore, gated wallust preseve theme Signed-off-by: Don Williams On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: copy.sh modified: scripts/lib_copy.sh --- copy.sh | 8 +++++- scripts/lib_copy.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/copy.sh b/copy.sh index eb994940..5258ce0a 100755 --- a/copy.sh +++ b/copy.sh @@ -505,6 +505,7 @@ if [ ! -d "${XDG_CONFIG_HOME:-$HOME/.config}" ]; then fi seed_upgrade_userconfigs "$LOG" capture_upgrade_runtime_selection_state +capture_runtime_personal_state "$LOG" printf "${INFO} - copying dotfiles ${SKY_BLUE}first${RESET} part\n" copy_phase1 "$LOG" "$RUN_MODE" @@ -698,6 +699,7 @@ restore_user_scripts "$LOG" "$EXPRESS_MODE" printf "\n%.0s" {1..1} restore_hypr_files "$LOG" "$EXPRESS_MODE" +restore_runtime_personal_state "$LOG" printf "\n%.0s" {1..1} printf "\n%.0s" {1..1} @@ -880,7 +882,11 @@ wallust_args=() if [ -f "$DOTFILES_DIR/config/hypr/scripts/WallustConfig.sh" ]; then . "$DOTFILES_DIR/config/hypr/scripts/WallustConfig.sh" fi -wallust "${wallust_args[@]}" run -s "$wallpaper" 2>&1 | tee -a "$LOG" +if [ "$RUN_MODE" != "install" ] && [ "${KOOLDOTS_RUNTIME_THEME_RESTORED:-0}" -eq 1 ]; then + echo "${NOTE} Preserved existing Wallust/global theme colors from pre-upgrade state; skipping wallust regeneration." 2>&1 | tee -a "$LOG" +else + wallust "${wallust_args[@]}" run -s "$wallpaper" 2>&1 | tee -a "$LOG" +fi if is_nixos && ! command -v waybar-weather >/dev/null 2>&1; then echo "${WARN} waybar-weather binary is missing." 2>&1 | tee -a "$LOG" echo "Install the current NixOS-Hyprland version to install waybar-weather applet for Waybar" 2>&1 | tee -a "$LOG" diff --git a/scripts/lib_copy.sh b/scripts/lib_copy.sh index 4d46785b..a5ec8651 100644 --- a/scripts/lib_copy.sh +++ b/scripts/lib_copy.sh @@ -248,6 +248,78 @@ capture_upgrade_runtime_selection_state() { export KOOLDOTS_PREV_ROFI_THEME_PATH } +capture_runtime_personal_state() { + local log="$1" + local cfg_home="${XDG_CONFIG_HOME:-$HOME/.config}" + local backup_dir + local state_dir + local src rel dest + + backup_dir=$(get_backup_dirname) + state_dir="${XDG_CACHE_HOME:-$HOME/.cache}/kooldots-runtime-state-$backup_dir" + KOOLDOTS_RUNTIME_STATE_DIR="$state_dir" + KOOLDOTS_RUNTIME_THEME_RESTORED=0 + export KOOLDOTS_RUNTIME_STATE_DIR + export KOOLDOTS_RUNTIME_THEME_RESTORED + + rm -rf "$state_dir" + mkdir -p "$state_dir" + + local files_to_capture=( + "$cfg_home/kitty/kitty.conf" + "$cfg_home/hypr/UserConfigs/kitty.conf" + "$cfg_home/hypr/wallpaper_effects/.wallpaper_current" + "$cfg_home/hypr/wallpaper_effects/.wallpaper_modified" + "$cfg_home/hypr/wallust/wallust-hyprland.conf" + "$cfg_home/rofi/wallust/colors-rofi.rasi" + "$cfg_home/waybar/wallust/colors-waybar.css" + "$cfg_home/kitty/kitty-themes/01-Wallust.conf" + ) + + for src in "${files_to_capture[@]}"; do + [ -f "$src" ] || continue + rel="${src#$cfg_home/}" + [ "$rel" != "$src" ] || continue + dest="$state_dir/$rel" + mkdir -p "$(dirname "$dest")" + cp -f "$src" "$dest" 2>/dev/null || true + done + + echo "${INFO:-[INFO]} - Captured runtime personalization state." 2>&1 | tee -a "$log" +} + +restore_runtime_personal_state() { + local log="$1" + local cfg_home="${XDG_CONFIG_HOME:-$HOME/.config}" + local state_dir="${KOOLDOTS_RUNTIME_STATE_DIR:-}" + local snapshot rel dest + local restored_theme=0 + + [ -d "$state_dir" ] || return 0 + + while IFS= read -r -d '' snapshot; do + rel="${snapshot#$state_dir/}" + dest="$cfg_home/$rel" + mkdir -p "$(dirname "$dest")" + if cp -f "$snapshot" "$dest" 2>&1 | tee -a "$log"; then + case "$rel" in + hypr/wallust/wallust-hyprland.conf | rofi/wallust/colors-rofi.rasi | waybar/wallust/colors-waybar.css | kitty/kitty-themes/01-Wallust.conf) + restored_theme=1 + ;; + esac + fi + done < <(find "$state_dir" -type f -print0) + + if [ -f "$cfg_home/kitty/kitty.conf" ] && [ ! -f "$cfg_home/hypr/UserConfigs/kitty.conf" ]; then + mkdir -p "$cfg_home/hypr/UserConfigs" + cp -f "$cfg_home/kitty/kitty.conf" "$cfg_home/hypr/UserConfigs/kitty.conf" 2>&1 | tee -a "$log" || true + fi + + KOOLDOTS_RUNTIME_THEME_RESTORED="$restored_theme" + export KOOLDOTS_RUNTIME_THEME_RESTORED + echo "${INFO:-[INFO]} - Restored runtime personalization state." 2>&1 | tee -a "$log" +} + restore_upgrade_runtime_selection_state() { local log="$1" local cfg_home="${XDG_CONFIG_HOME:-$HOME/.config}" -- cgit v1.2.3