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
|
# Set default terminal to Alacritty
|
||||||
if command -v alacritty >/dev/null 2>&1; then
|
if command -v alacritty >/dev/null 2>&1; then
|
||||||
|
# 1. Update the traditional XFCE helpers file
|
||||||
mkdir -p "$HOME/.config/xfce4"
|
mkdir -p "$HOME/.config/xfce4"
|
||||||
HELPERS_FILE="$HOME/.config/xfce4/helpers.rc"
|
HELPERS_FILE="$HOME/.config/xfce4/helpers.rc"
|
||||||
|
|
||||||
touch "$HELPERS_FILE"
|
touch "$HELPERS_FILE"
|
||||||
|
|
||||||
# TerminalEmulator entry
|
for entry in TerminalEmulator TerminalEmulatorCommand; do
|
||||||
if grep -q '^TerminalEmulator=' "$HELPERS_FILE"; then
|
if grep -q "^${entry}=" "$HELPERS_FILE"; then
|
||||||
sed -i 's|^TerminalEmulator=.*|TerminalEmulator=alacritty|' "$HELPERS_FILE"
|
sed -i "s|^${entry}=.*|${entry}=alacritty|" "$HELPERS_FILE"
|
||||||
else
|
else
|
||||||
echo "TerminalEmulator=alacritty" >> "$HELPERS_FILE"
|
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
|
fi
|
||||||
|
|
||||||
# TerminalEmulatorCommand entry
|
# 3. Set standard XDG MIME Association for terminal execution
|
||||||
if grep -q '^TerminalEmulatorCommand=' "$HELPERS_FILE"; then
|
# This prevents XFCE's exo-helper from prompting you on first launch
|
||||||
sed -i 's|^TerminalEmulatorCommand=.*|TerminalEmulatorCommand=alacritty|' "$HELPERS_FILE"
|
mkdir -p "$HOME/.config"
|
||||||
else
|
MIME_FILE="$HOME/.config/mimeapps.list"
|
||||||
echo "TerminalEmulatorCommand=alacritty" >> "$HELPERS_FILE"
|
touch "$MIME_FILE"
|
||||||
|
|
||||||
|
# Ensure the [Default Applications] header exists
|
||||||
|
if ! grep -q '\[Default Applications\]' "$MIME_FILE"; then
|
||||||
|
echo "[Default Applications]" >> "$MIME_FILE"
|
||||||
fi
|
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
|
||||||
fi
|
|
||||||
|
|
||||||
pause_if_debug
|
pause_if_debug
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user