diff --git a/fedora/fedora-xfce.sh b/fedora/fedora-xfce.sh index 72701ac..b363e21 100755 --- a/fedora/fedora-xfce.sh +++ b/fedora/fedora-xfce.sh @@ -110,10 +110,13 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then pause_if_debug - # Set default terminal to Alacritty +# Set default terminal to Alacritty if command -v alacritty >/dev/null 2>&1; then - # 1. Update the traditional XFCE helpers file + # 1. Force initialize the base XDG/XFCE config hierarchy mkdir -p "$HOME/.config/xfce4" + mkdir -p "$HOME/.config/menus" + + # 2. Configure XFCE's preferred application files HELPERS_FILE="$HOME/.config/xfce4/helpers.rc" touch "$HELPERS_FILE" @@ -125,31 +128,41 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then fi done - # 2. Update XFCE's internal configuration database (Xfconf) - # This tells the panel applets and shortcut keys exactly what engine binary to execute - if command -v xfconf-query >/dev/null 2>&1; then - # Create the channel property if it doesn't exist, and force set it to alacritty - xfconf-query -c xfce4-session -p /general/TerminalEmulator -s "alacritty" --create 2>/dev/null || \ - xfconf-query -c xfce4-session -p /general/TerminalEmulator -s "alacritty" - fi - - # 3. Set standard XDG MIME Association for terminal execution - # This prevents XFCE's exo-helper from prompting you on first launch - mkdir -p "$HOME/.config" + # 3. Create the missing standard XDG MIME association files manually MIME_FILE="$HOME/.config/mimeapps.list" touch "$MIME_FILE" - # Ensure the [Default Applications] header exists - if ! grep -q '\[Default Applications\]' "$MIME_FILE"; then - echo "[Default Applications]" >> "$MIME_FILE" - fi - - # Associate terminal/x-terminal-emulator scheme with alacritty - if ! grep -q 'x-terminal-emulator=' "$MIME_FILE"; then - sed -i '/\[Default Applications\]/a x-scheme-handler/terminal=alacritty.desktop\nuser-extension/x-terminal-emulator=alacritty.desktop' "$MIME_FILE" + # Rewrite/initialize the file cleanly with explicit defaults + cat < "$MIME_FILE" +[Default Applications] +x-scheme-handler/terminal=alacritty.desktop +user-extension/x-terminal-emulator=alacritty.desktop +EOF + + # 4. Handle System-Wide Alternatives (For Debian/Ubuntu/Fedora base integrations) + # This covers the underlying system-wide 'x-terminal-emulator' mapping + if command -v update-alternatives >/dev/null 2>&1; then + if [ -f "/usr/share/applications/alacritty.desktop" ] || [ -f "/usr/local/share/applications/alacritty.desktop" ]; then + sudo update-alternatives --set x-terminal-emulator $(which alacritty) 2>/dev/null || true + fi fi - color_green "XFCE default terminal set to alacritty across helpers, xfconf, and XDG handlers!" + # 5. Pre-seed Xfconf properties directly into the XML tree file structure + # Since xfconfd might not be running yet, we write the raw file backup structure directly + XFCONF_DIR="$HOME/.config/xfce4/xfconf/xfce-perchannel-xml" + mkdir -p "$XFCONF_DIR" + + # Pre-populate the session XML so xfce skips selection entirely on first boot + cat < "$XFCONF_DIR/xfce4-session.xml" + + + + + + +EOF + + color_green "XFCE default terminal configurations written directly to persistent user storage!" fi pause_if_debug