From 62e1040b4d6b2b42bdaa5dbe7701b115203f1a75 Mon Sep 17 00:00:00 2001 From: "[yuri]" <[yuri.kuit@gmail.com]> Date: Tue, 11 Nov 2025 15:38:11 +0100 Subject: [PATCH] final fix --- v2/debian-full.sh | 136 ++++++++++++++++++++++++++++------------------ 1 file changed, 83 insertions(+), 53 deletions(-) diff --git a/v2/debian-full.sh b/v2/debian-full.sh index 2362aa0..127cc50 100755 --- a/v2/debian-full.sh +++ b/v2/debian-full.sh @@ -124,60 +124,90 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then fi say_green "XFCE defeault terminal set to alacritty!" fi - - # Set basic configuration - SOURCE_DIR="$SCRIPT_DIR/config-files/debian" - DEST_DIR="$HOME" - - # Check source directory - if [ ! -d "$SOURCE_DIR" ]; then - say_red "Error: Source directory '$SOURCE_DIR' not found. Aborting." - exit 1 - fi - - # Detect if XFCE is running - XFCE_WAS_RUNNING=0 - if pgrep -x "xfce4-panel" >/dev/null || pgrep -x "xfconfd" >/dev/null; then - XFCE_WAS_RUNNING=1 - say_yellow "Stopping all XFCE components..." - pkill -x xfce4-panel - pkill -x xfconfd - pkill -x xfwm4 - pkill -x xfsettingsd - pkill -x xfce4-session - sleep 1 - fi - - # Clean cache before copying - say_yellow "Removing old Xfce session cache..." - rm -rf "$HOME/.cache/sessions" - - # Copy configs (including hidden) - say_yellow "Copying configuration files..." - shopt -s dotglob - cp -vrf "$SOURCE_DIR"/* "$DEST_DIR"/ - shopt -u dotglob - - # Ensure ownership - chown -R "$(id -u):$(id -g)" "$DEST_DIR/.config/xfce4" - - say_green "Configuration files copied." - - # Restart Xfce components only if it was running before - if [ "$XFCE_WAS_RUNNING" -eq 1 ]; then - say_bold "Restarting Xfce to apply new configuration..." - nohup xfconfd & - nohup xfwm4 --replace & - nohup xfce4-panel & - nohup xfsettingsd & - disown - say_green "XFCE configuration applied successfully." - else - say_cyan "XFCE was not running. Please log out and back in to load new settings." - fi - - fi +############################################### +# Copy settings to HOME +############################################### +SOURCE_DIR="$SCRIPT_DIR/config-files/debian" +DEST_DIR="$HOME" +AUTOSTART_DIR="$HOME/.config/autostart" +XFCE_SESSION_DIR="$HOME/.cache/sessions" + +# 1. Verify source directory exists +if [ ! -d "$SOURCE_DIR" ]; then + say_red "Error: Source directory '$SOURCE_DIR' not found. Aborting." + exit 1 +fi + +# 2. Detect running XFCE session +if pgrep -x "xfce4-panel" >/dev/null || pgrep -x "xfconfd" >/dev/null; then + say_yellow "XFCE session is currently active." + + # Check if we're on a Debian-based system + if grep -qiE "debian|ubuntu|mint" /etc/os-release; then + say_yellow "Detected Debian-based system. Deferring configuration to next login." + + mkdir -p "$AUTOSTART_DIR" + AUTOSTART_FILE="$AUTOSTART_DIR/xfce-config-apply.desktop" + + cat > "$AUTOSTART_FILE" </dev/null; then + say_cyan "Restarting XFCE environment components..." + nohup xfconfd &>/dev/null & + nohup xfwm4 --replace &>/dev/null & + nohup xfce4-panel &>/dev/null & + disown + say_green "XFCE configuration reloaded successfully." +else + say_cyan "XFCE was not running. Configuration will load on next login." +fi + + # End of script say_green "Full setup completed."