bugfix
This commit is contained in:
@@ -137,34 +137,38 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then
|
|||||||
|
|
||||||
# 2. Aggressively Stop Xfce Processes if XFCE active
|
# 2. Aggressively Stop Xfce Processes if XFCE active
|
||||||
if pgrep -x "xfce4-panel" > /dev/null; then
|
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..."
|
say_yellow "Stopping Xfce Panel and Configuration Daemon to prevent settings overwrite..."
|
||||||
|
# Kill the panel, configuration daemon, and window manager
|
||||||
pkill xfce4-panel
|
pkill xfce4-panel
|
||||||
pkill xfconfd
|
pkill xfconfd
|
||||||
pkill xfwm4
|
pkill xfwm4
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
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"
|
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
|
shopt -s dotglob
|
||||||
|
|
||||||
|
# Copy the entire directory structure into $HOME, merging files where necessary.
|
||||||
cp -vrf "$SOURCE_DIR"/* "$DEST_DIR"/
|
cp -vrf "$SOURCE_DIR"/* "$DEST_DIR"/
|
||||||
|
|
||||||
|
# Disable dotglob to revert the shell behavior
|
||||||
shopt -u dotglob
|
shopt -u dotglob
|
||||||
|
|
||||||
# 4. Restart Xfce processes to load the new configuration
|
say_green "Configurations copied to disk."
|
||||||
# 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
|
|
||||||
|
|
||||||
|
# 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
|
# 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
|
# Restart the Window Manager first
|
||||||
xfwm4 --replace & disown
|
xfwm4 --replace & disown
|
||||||
@@ -175,7 +179,7 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then
|
|||||||
say_green "Xfce configuration successfully loaded and applied."
|
say_green "Xfce configuration successfully loaded and applied."
|
||||||
say_cyan "Panel and Window Manager restarted."
|
say_cyan "Panel and Window Manager restarted."
|
||||||
else
|
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."
|
say_cyan "Please log out and log back in to fully apply the Xfce configuration changes."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user