v3-revamp-fedora
This commit is contained in:
+31
-13
@@ -112,27 +112,45 @@ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then
|
||||
|
||||
# Set default terminal to Alacritty
|
||||
if command -v alacritty >/dev/null 2>&1; then
|
||||
# 1. Update the traditional XFCE helpers file
|
||||
mkdir -p "$HOME/.config/xfce4"
|
||||
HELPERS_FILE="$HOME/.config/xfce4/helpers.rc"
|
||||
|
||||
touch "$HELPERS_FILE"
|
||||
|
||||
# TerminalEmulator entry
|
||||
if grep -q '^TerminalEmulator=' "$HELPERS_FILE"; then
|
||||
sed -i 's|^TerminalEmulator=.*|TerminalEmulator=alacritty|' "$HELPERS_FILE"
|
||||
else
|
||||
echo "TerminalEmulator=alacritty" >> "$HELPERS_FILE"
|
||||
for entry in TerminalEmulator TerminalEmulatorCommand; do
|
||||
if grep -q "^${entry}=" "$HELPERS_FILE"; then
|
||||
sed -i "s|^${entry}=.*|${entry}=alacritty|" "$HELPERS_FILE"
|
||||
else
|
||||
echo "${entry}=alacritty" >> "$HELPERS_FILE"
|
||||
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
|
||||
|
||||
# TerminalEmulatorCommand entry
|
||||
if grep -q '^TerminalEmulatorCommand=' "$HELPERS_FILE"; then
|
||||
sed -i 's|^TerminalEmulatorCommand=.*|TerminalEmulatorCommand=alacritty|' "$HELPERS_FILE"
|
||||
else
|
||||
echo "TerminalEmulatorCommand=alacritty" >> "$HELPERS_FILE"
|
||||
# 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"
|
||||
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
|
||||
color_green "XFCE default terminal set to alacritty!"
|
||||
|
||||
# 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"
|
||||
fi
|
||||
|
||||
color_green "XFCE default terminal set to alacritty across helpers, xfconf, and XDG handlers!"
|
||||
fi
|
||||
fi
|
||||
|
||||
pause_if_debug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user