From 68bb83f5b856217e312e8c7d6cec2bd829f2324f Mon Sep 17 00:00:00 2001 From: "[yuri]" <[yuri.kuit@gmail.com]> Date: Tue, 11 Nov 2025 14:59:11 +0100 Subject: [PATCH] bugfix --- v2/debian-full.sh | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/v2/debian-full.sh b/v2/debian-full.sh index 07c2979..3fd7d98 100755 --- a/v2/debian-full.sh +++ b/v2/debian-full.sh @@ -137,34 +137,38 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then # 2. Aggressively Stop Xfce Processes if XFCE active if pgrep -x "xfce4-panel" > /dev/null; then + # Store the state that Xfce was running + XFCE_WAS_RUNNING=1 + say_yellow "Stopping Xfce Panel and Configuration Daemon to prevent settings overwrite..." + # Kill the panel, configuration daemon, and window manager pkill xfce4-panel pkill xfconfd pkill xfwm4 sleep 1 fi - # 3. Copy files from source to destination recursively + # 3. Copy files from source to destination recursively (Unconditional) say_yellow "Copying all files and directories (including hidden ones) from $SOURCE_DIR to $DEST_DIR" + + # Enable dotglob so that '*' matches files starting with '.' (like .config) shopt -s dotglob + + # Copy the entire directory structure into $HOME, merging files where necessary. cp -vrf "$SOURCE_DIR"/* "$DEST_DIR"/ + + # Disable dotglob to revert the shell behavior shopt -u dotglob - # 4. Restart Xfce processes to load the new configuration - # We check for a running 'xfce4-panel' process to determine if we are in an Xfce session. - if pgrep -x "xfce4-panel" > /dev/null; then - say_bold "Xfce Panel detected. Applying configuration changes immediately." - - # Aggressively stop Xfce processes to prevent the old settings from being saved. - say_yellow "Stopping Xfce Panel and Configuration Daemon to prevent settings overwrite..." - pkill xfce4-panel - pkill xfconfd - # Optionally stop the window manager, to ensure a full refresh - pkill xfwm4 - sleep 1 + say_green "Configurations copied to disk." + # 4. Restart Xfce processes to load the new configuration (Conditional on initial state) + # We use the stored XFCE_WAS_RUNNING variable to ensure we restart if we killed processes. + if [ "$XFCE_WAS_RUNNING" -eq 1 ]; then + say_bold "Xfce was detected. Restarting components to load new configuration." + # Restart Xfce processes to load the new configuration from the copied files - say_cyan "Restarting Xfce environment components to load the new layout..." + say_cyan "Restarting Xfce environment components..." # Restart the Window Manager first xfwm4 --replace & disown @@ -175,7 +179,7 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then say_green "Xfce configuration successfully loaded and applied." say_cyan "Panel and Window Manager restarted." else - say_cyan "Xfce Panel process not found. Configurations copied to $HOME." + say_cyan "Xfce Panel was not running. Configurations copied to $HOME." say_cyan "Please log out and log back in to fully apply the Xfce configuration changes." fi