#!/bin/bash set -euo pipefail #------------------------------------------ # Color helpers (printf-safe, no tput) #------------------------------------------ RED="\033[0;31m" GREEN="\033[0;32m" YELLOW="\033[0;33m" CYAN="\033[0;36m" GRAY="\033[0;37m" BOLD="\033[1m" RESET="\033[0m" # Disable colors if output is not a terminal if [ ! -t 1 ]; then RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET="" fi color_yellow() { printf '%b' "$YELLOW"; } color_cyan() { printf '%b' "$CYAN"; } color_red() { printf '%b' "$RED"; } color_green() { printf '%b' "$GREEN"; } color_gray() { printf '%b' "$GRAY"; } color_reset() { printf '%b' "$RESET"; } #------------------------------------------ # Use exported variables from main detection script #------------------------------------------ OS="${DETECTED_OS}" DDE="${DETECTED_DE:-}" DE="${SELECTED_DE:-none}" TWM="${SELECTED_TWM:-none}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" #------------------------------------------ # Helper functions #------------------------------------------ install_packages() { sudo dnf install -y "$@"; } is_package_installed() { rpm -q "$@" &>/dev/null; } color_yellow "Starting XFCE installation..." CURRENT_DE="$(detect_de)" CURRENT_DM="$(detect_display_manager)" if [[ -z "$CURRENT_DE" ]]; then color_cyan -e "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..." install_packages sddm xfce4 xfce4-goodies enable_graphical_target color_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE." else color_cyan -e "Detected existing Desktop Environment: $CURRENT_DE" if [[ "$CURRENT_DM" == "lightdm" ]]; then color_yellow -e "LightDM is currently active. Replacing with SDDM..." sudo systemctl disable lightdm sudo pacman -Rns lightdm lightdm-gtk-greeter install_packages sddm enable_graphical_target color_green -e "LightDM removed and replaced with SDDM." else color_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged." fi fi #------------------------------------------ # XFCE-specific configuration #------------------------------------------ if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then echo color_cyan "Applying XFCE defaults: fonts, browser, and terminal..." # Ensure xfconf-query exists (for XFCE settings) if ! command -v xfconf-query >/dev/null 2>&1; then color_yellow "xfconf-query not found — installing xfce4-settings..." install_packages xfce4-settings fi # set fonts # Wait for xfconf to be available (only needed if running inside the same session) if command -v xfconf-query >/dev/null 2>&1; then # Interface font (UI) xfconf-query -c xsettings -p /Gtk/FontName -s "RobotoMono Nerd Font Regular 10" # Monospace font (terminals, editors) xfconf-query -c xsettings -p /Gtk/MonospaceFontName -s "RobotoMono Nerd Font Mono Regular 10" color_green "XFCE fonts updated successfully!" else color_yellow "xfconf-query not found — skipping XFCE font config (will apply at first login)." fi # Set default terminal if command -v alacritty >/dev/null 2>&1; then 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" fi # TerminalEmulatorCommand entry if grep -q '^TerminalEmulatorCommand=' "$HELPERS_FILE"; then sed -i 's|^TerminalEmulatorCommand=.*|TerminalEmulatorCommand=alacritty|' "$HELPERS_FILE" else echo "TerminalEmulatorCommand=alacritty" >> "$HELPERS_FILE" fi color_green "XFCE defeault terminal set to alacritty!" fi fi # End of script color_green -e "XFCE / SDDM setup completed."