v3-revamp-fedora
This commit is contained in:
+29
-36
@@ -110,50 +110,43 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then
|
|||||||
|
|
||||||
pause_if_debug
|
pause_if_debug
|
||||||
|
|
||||||
# Set default terminal to Alacritty
|
# Set default terminal to Alacritty (Configured unconditionally)
|
||||||
if command -v alacritty >/dev/null 2>&1; then
|
color_cyan "Pre-configuring XFCE default terminal settings for Alacritty..."
|
||||||
# 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
|
# 1. Force initialize the base XDG/XFCE config hierarchy
|
||||||
HELPERS_FILE="$HOME/.config/xfce4/helpers.rc"
|
mkdir -p "$HOME/.config/xfce4"
|
||||||
touch "$HELPERS_FILE"
|
mkdir -p "$HOME/.config/menus"
|
||||||
|
|
||||||
for entry in TerminalEmulator TerminalEmulatorCommand; do
|
# 2. Configure XFCE's preferred application files
|
||||||
if grep -q "^${entry}=" "$HELPERS_FILE"; then
|
HELPERS_FILE="$HOME/.config/xfce4/helpers.rc"
|
||||||
sed -i "s|^${entry}=.*|${entry}=alacritty|" "$HELPERS_FILE"
|
touch "$HELPERS_FILE"
|
||||||
else
|
|
||||||
echo "${entry}=alacritty" >> "$HELPERS_FILE"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# 3. Create the missing standard XDG MIME association files manually
|
for entry in TerminalEmulator TerminalEmulatorCommand; do
|
||||||
MIME_FILE="$HOME/.config/mimeapps.list"
|
if grep -q "^${entry}=" "$HELPERS_FILE"; then
|
||||||
touch "$MIME_FILE"
|
sed -i "s|^${entry}=.*|${entry}=alacritty|" "$HELPERS_FILE"
|
||||||
|
else
|
||||||
|
echo "${entry}=alacritty" >> "$HELPERS_FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Rewrite/initialize the file cleanly with explicit defaults
|
# 3. Create the standard XDG MIME association files manually
|
||||||
cat <<EOF > "$MIME_FILE"
|
mkdir -p "$HOME/.config"
|
||||||
|
MIME_FILE="$HOME/.config/mimeapps.list"
|
||||||
|
touch "$MIME_FILE"
|
||||||
|
|
||||||
|
# Rewrite/initialize the file cleanly with explicit defaults
|
||||||
|
cat <<EOF > "$MIME_FILE"
|
||||||
[Default Applications]
|
[Default Applications]
|
||||||
x-scheme-handler/terminal=alacritty.desktop
|
x-scheme-handler/terminal=alacritty.desktop
|
||||||
user-extension/x-terminal-emulator=alacritty.desktop
|
user-extension/x-terminal-emulator=alacritty.desktop
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 4. Handle System-Wide Alternatives (For Debian/Ubuntu/Fedora base integrations)
|
# 4. Pre-seed Xfconf properties directly into the XML tree file structure
|
||||||
# This covers the underlying system-wide 'x-terminal-emulator' mapping
|
# This bypasses xfconf-query entirely and drops settings directly into storage
|
||||||
if command -v update-alternatives >/dev/null 2>&1; then
|
XFCONF_DIR="$HOME/.config/xfce4/xfconf/xfce-perchannel-xml"
|
||||||
if [ -f "/usr/share/applications/alacritty.desktop" ] || [ -f "/usr/local/share/applications/alacritty.desktop" ]; then
|
mkdir -p "$XFCONF_DIR"
|
||||||
sudo update-alternatives --set x-terminal-emulator $(which alacritty) 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 5. Pre-seed Xfconf properties directly into the XML tree file structure
|
cat <<EOF > "$XFCONF_DIR/xfce4-session.xml"
|
||||||
# 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 <<EOF > "$XFCONF_DIR/xfce4-session.xml"
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<channel name="xfce4-session" version="1.0">
|
<channel name="xfce4-session" version="1.0">
|
||||||
<property name="general" type="empty">
|
<property name="general" type="empty">
|
||||||
@@ -162,8 +155,8 @@ EOF
|
|||||||
</channel>
|
</channel>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
color_green "XFCE default terminal configurations written directly to persistent user storage!"
|
color_green "XFCE terminal presets dropped into user skeleton profiles successfully."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
pause_if_debug
|
pause_if_debug
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user