#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" cp "$SCRIPT_DIR/config/Colors.qml.template" "$SCRIPT_DIR/config/Colors.qml" cp "$SCRIPT_DIR/config/path/ConfigPath.qml.template" "$SCRIPT_DIR/config/path/ConfigPath.qml" sed -i "s|__CONFIG_DIR__|$SCRIPT_DIR|g" "$SCRIPT_DIR/config/path/ConfigPath.qml" # ---------------------------- # UI helpers # ---------------------------- info() { echo -e "\033[1;34m[INFO]\033[0m $*"; } ok() { echo -e "\033[1;32m[ OK ]\033[0m $*"; } warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; } fail() { echo -e "\033[1;31m[FAIL]\033[0m $*"; } download() { local url="$1" local out="$2" local name="${3:-$(basename "$out")}" info "Downloading $name" if curl -fL --progress-bar "$url" -o "$out"; then ok "Saved $name" else fail "Failed $name" return 1 fi } transform_svg_white() { local url="$1" local out="$2" local name="${3:-$(basename "$out")}" info "Fetching + whitening $name" if curl -fsSL "$url" \ | sed -E 's/#[0-9a-fA-F]{3,6}/#ffffff/g' \ > "$out"; then ok "Generated $name" else fail "Failed $name" return 1 fi } # ---------------------------- # Start # ---------------------------- echo info "Preparing wlogout icons..." mkdir -p "$SCRIPT_DIR/modules/wlogout/icons" # ---------------------------- # Icons (wlogout) # ---------------------------- transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/src/actions/symbolic/system-hibernate-symbolic.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/hibernate.svg" \ "hibernate.svg" transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/bold/actions/symbolic/system-lock-screen-symbolic.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/lock.svg" \ "lock.svg" transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/src/status/symbolic/logout-symbolic.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/logout.svg" \ "logout.svg" transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/src/actions/symbolic/system-reboot-symbolic.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/reboot.svg" \ "reboot.svg" transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/src/actions/symbolic/system-shutdown-symbolic.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/shutdown.svg" \ "shutdown.svg" transform_svg_white \ "https://raw.githubusercontent.com/vinceliuice/Colloid-icon-theme/main/src/actions/24/system-suspend.svg" \ "$SCRIPT_DIR/modules/wlogout/icons/suspend.svg" \ "suspend.svg" # ---------------------------- # UI icons # ---------------------------- echo info "Preparing global icons..." mkdir -p "$SCRIPT_DIR/modules/jl/assets" download \ "https://raw.githubusercontent.com/Tekh-ops/Garuda-Linux-Icons/refs/heads/master/actions/scalable/window-close.svg" \ "$SCRIPT_DIR/modules/jl/assets/wrong.svg" \ "wrong.svg" download \ "https://raw.githubusercontent.com/Tekh-ops/Garuda-Linux-Icons/refs/heads/master/actions/scalable/dialog-ok-apply.svg" \ "$SCRIPT_DIR/modules/jl/assets/correct.svg" \ "correct.svg" # ---------------------------- # Nerd Font # ---------------------------- echo info "Installing CodeNewRoman Nerd Font..." FONT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/fonts" mkdir -p "$FONT_DIR" if [ ! -f "$FONT_DIR/CodeNewRomanNerdFont-Regular.ttf" ]; then download \ "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/CodeNewRoman.tar.xz" \ "/tmp/CodeNewRoman.tar.xz" \ "CodeNewRoman Nerd Font" tar -xf /tmp/CodeNewRoman.tar.xz -C "$FONT_DIR" --wildcards '*.ttf' 2>/dev/null || \ tar -xf /tmp/CodeNewRoman.tar.xz -C "$FONT_DIR" rm -f /tmp/CodeNewRoman.tar.xz if command -v fc-cache &>/dev/null; then fc-cache -fv "$FONT_DIR" &>/dev/null fi ok "CodeNewRoman Nerd Font installed" else ok "CodeNewRoman Nerd Font already installed" fi # ---------------------------- # Japanese Font (for JLearner) # ---------------------------- echo info "Installing Noto Sans JP font..." if [ ! -f "$FONT_DIR/NotoSansJP.ttf" ]; then download \ "https://github.com/google/fonts/raw/main/ofl/notosansjp/NotoSansJP%5Bwght%5D.ttf" \ "$FONT_DIR/NotoSansJP.ttf" \ "Noto Sans JP" ok "Noto Sans JP font installed" else ok "Noto Sans JP font already installed" fi # ---------------------------- # Font cache reload # ---------------------------- echo info "Reloading font cache..." if command -v fc-cache &>/dev/null; then fc-cache -fv &>/dev/null ok "Font cache reloaded" else warn "fc-cache not found — font cache not updated" fi # ---------------------------- # Example Wallpaper # ---------------------------- echo info "Preparing wallpaper..." WALLPAPER_DIR=$(scripts/wallpaper_dir.sh) mkdir -p "$WALLPAPER_DIR" info "Copying example Wallpaper..." cp "$SCRIPT_DIR/assets/example_background.png" "$WALLPAPER_DIR/japan_old_emperor_stream_with_bridge.png" info "Creating Wallpaper Folder Config" cp "$SCRIPT_DIR/config/path/WallpaperPath.qml.template" "$SCRIPT_DIR/config/path/WallpaperPath.qml" sed -i "s|__CONFIG_DIR__|$WALLPAPER_DIR|g" "$SCRIPT_DIR/config/path/WallpaperPath.qml" echo ok "All assets prepared successfully."