This commit is contained in:
[yuri]
2025-11-11 15:48:54 +01:00
parent 15928c3e90
commit 44913f6027

View File

@@ -132,6 +132,7 @@ fi
SOURCE_DIR="$SCRIPT_DIR/config-files/debian"
DEST_DIR="$HOME"
AUTOSTART_DIR="$HOME/.config/autostart"
HELPER_DIR="$HOME/.local/share/xfce-config-apply"
XFCE_SESSION_DIR="$HOME/.cache/sessions"
# 1. Verify source directory exists
@@ -144,35 +145,44 @@ fi
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
# Debian-based detection
if grep -qiE "debian|ubuntu|mint" /etc/os-release; then
say_yellow "Detected Debian-based system. Deferring configuration to next login."
say_yellow "Detected Debian-based system. Scheduling configuration for next login."
mkdir -p "$AUTOSTART_DIR"
mkdir -p "$AUTOSTART_DIR" "$HELPER_DIR"
AUTOSTART_FILE="$AUTOSTART_DIR/xfce-config-apply.desktop"
HELPER_SCRIPT="$HELPER_DIR/run-once.sh"
cat > "$AUTOSTART_FILE" <<EOF
[Desktop Entry]
Type=Application
Name=Apply XFCE Config
Comment=One-time XFCE configuration importer
Exec=bash -c '
# --- Create helper script ---
cat > "$HELPER_SCRIPT" <<EOF
#!/usr/bin/env bash
shopt -s dotglob
cp -vrf "$SOURCE_DIR"/* "$DEST_DIR"/
shopt -u dotglob
rm -rf "$XFCE_SESSION_DIR"
rm -f "$AUTOSTART_FILE"
echo "XFCE config applied on login and autostart entry removed."
'
rm -rf "$HELPER_DIR"
echo "XFCE configuration applied and helper removed."
EOF
chmod +x "$HELPER_SCRIPT"
# --- Create autostart file ---
cat > "$AUTOSTART_FILE" <<EOF
[Desktop Entry]
Type=Application
Name=Apply XFCE Config
Comment=One-time XFCE configuration importer
Exec=$HELPER_SCRIPT
OnlyShowIn=XFCE;
X-GNOME-Autostart-enabled=true
Hidden=false
NoDisplay=false
EOF
say_green "Created one-time autostart task:"
say_green "Created one-time autostart helper:"
say_gray " $AUTOSTART_FILE"
say_cyan "Log out and back in to apply the new XFCE configuration."
say_cyan "Log out and back in to apply your new XFCE configuration."
exit 0
else
say_cyan "Non-Debian system detected — applying configuration live."