This commit is contained in:
MacRimi 2025-03-02 19:58:38 +01:00
parent b531f05ac8
commit 6f3d544109

View File

@ -2095,29 +2095,26 @@ configure_fastfetch() {
# Modify Fastfetch modules to display custom title # Modify Fastfetch modules to display custom title
msg_info "$(translate "Modifying Fastfetch configuration...")" msg_info "$(translate "Modifying Fastfetch configuration...")"
# Use temporary files for jq operations # Eliminar "title" si existe en la configuración
local temp_config=$(mktemp) jq '.modules |= map(select(. != "title"))' ~/.config/fastfetch/config.jsonc > ~/.config/fastfetch/config.jsonc.tmp && mv ~/.config/fastfetch/config.jsonc.tmp ~/.config/fastfetch/config.jsonc
# Remove "title" if it exists in the configuration # Asegurar que solo haya una entrada "custom"
jq '.modules |= map(select(. != "title"))' "$fastfetch_config" > "$temp_config" && mv "$temp_config" "$fastfetch_config" jq 'del(.modules[] | select(type == "object" and .type == "custom"))' ~/.config/fastfetch/config.jsonc > ~/.config/fastfetch/config.jsonc.tmp && mv ~/.config/fastfetch/config.jsonc.tmp ~/.config/fastfetch/config.jsonc
# Ensure there's only one "custom" entry # Agregar la entrada "custom" al inicio de los módulos si no existe
jq 'del(.modules[] | select(type == "object" and .type == "custom"))' "$fastfetch_config" > "$temp_config" && mv "$temp_config" "$fastfetch_config" jq '.modules |= [{"type": "custom", "format": "\u001b[1;38;5;166mSystem optimised by ProxMenux\u001b[0m"}] + .' ~/.config/fastfetch/config.jsonc > ~/.config/fastfetch/config.jsonc.tmp && mv ~/.config/fastfetch/config.jsonc.tmp ~/.config/fastfetch/config.jsonc
# Add the "custom" entry to the beginning of the modules
jq '.modules |= [{"type": "custom", "format": "\u001b[1;38;5;166mSystem optimised by ProxMenux\u001b[0m"}] + .' "$fastfetch_config" > "$temp_config" && mv "$temp_config" "$fastfetch_config"
msg_ok "$(translate "Fastfetch now displays: System optimised by: ProxMenux")" msg_ok "$(translate "Fastfetch now displays: System optimised by: ProxMenux")"
# Regenerate configuration (prevents Fastfetch from overwriting changes) # Regenerar configuración (evita que Fastfetch sobrescriba cambios)
fastfetch --gen-config > /dev/null 2>&1 fastfetch --gen-config > /dev/null 2>&1
msg_ok "$(translate "Fastfetch configuration updated")" msg_ok "$(translate "Fastfetch configuration updated")"
# Remove previous instances of Fastfetch in bashrc and profiles # Eliminar instancias previas de Fastfetch en bashrc y perfiles
sed -i '/fastfetch/d' ~/.bashrc ~/.profile /etc/profile sed -i '/fastfetch/d' ~/.bashrc ~/.profile /etc/profile
rm -f /etc/update-motd.d/99-fastfetch rm -f /etc/update-motd.d/99-fastfetch
# Add Fastfetch to ~/.bashrc to run on each login # Agregar Fastfetch a ~/.bashrc para que se ejecute en cada inicio de sesión
echo "clear && fastfetch" >> ~/.bashrc echo "clear && fastfetch" >> ~/.bashrc
msg_ok "$(translate "Fastfetch will start automatically in the console")" msg_ok "$(translate "Fastfetch will start automatically in the console")"