Initial commit — violet-chaton ricing setup

Environnement terminal complet aux couleurs violet-chaton pour Pop!_OS / Ubuntu avec COSMIC Desktop.
Inclut scripts d'installation, configs shell, thèmes et support COSMIC/Vivaldi/Vesktop.
This commit is contained in:
Tetardtek
2026-02-21 20:27:14 +01:00
commit ee455870f5
80 changed files with 7096 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
#!/bin/bash
# ── violet-chaton : paquets apt ───────────────────────────────────────────────
source "$(dirname "$0")/lib.sh"
PACKAGES=(
zsh
eza
bat
fd-find
fzf
zoxide
git-delta
vivid
ripgrep
ncdu
thefuck
lolcat
cbonsai
chafa
jq
libgtk-3-bin
nemo
nemo-fileroller
# fastfetch → installé via .deb GitHub (voir 02-packages-manual.sh)
cava
btop
# atuin → installé via son propre script (voir 02-packages-manual.sh)
# starship → installé via son propre script (voir 02-packages-manual.sh)
# ── Fun & utils ──────────────────────────────────────────────────────────
cmatrix
toilet
w3m
jp2a
qalc
)
section "Installation des paquets apt"
step "Mise à jour des dépôts..."
sudo apt update -qq 2>/dev/null && ok "Dépôts mis à jour" || { fail "Échec apt update" ; exit 1; }
for pkg in "${PACKAGES[@]}"; do
if dpkg -s "$pkg" &>/dev/null; then
ok "$pkg (déjà installé)"
else
step "Installation de $pkg..."
if sudo apt install -y "$pkg" -qq 2>/dev/null; then
ok "$pkg"
else
fail "$pkg — vérifier le nom du paquet"
fi
fi
done
section "Vivaldi (navigateur)"
if dpkg -s vivaldi-stable &>/dev/null; then
ok "vivaldi-stable (déjà installé)"
else
step "Ajout du dépôt Vivaldi..."
curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub \
| sudo gpg --dearmor -o /usr/share/keyrings/vivaldi-browser.gpg 2>/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] \
https://repo.vivaldi.com/archive/deb/ stable main" \
| sudo tee /etc/apt/sources.list.d/vivaldi.list &>/dev/null && \
sudo apt update -qq 2>/dev/null && ok "Dépôt ajouté" || { fail "Dépôt Vivaldi — échec" ; }
step "Installation de vivaldi-stable..."
sudo apt install -y vivaldi-stable -qq 2>/dev/null && \
ok "vivaldi-stable" || fail "vivaldi-stable"
fi
section "GitHub CLI (gh)"
if dpkg -s gh &>/dev/null; then
ok "gh (déjà installé)"
else
step "Ajout du dépôt GitHub CLI..."
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg 2>/dev/null && \
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
| sudo tee /etc/apt/sources.list.d/github-cli.list &>/dev/null && \
sudo apt update -qq 2>/dev/null && ok "Dépôt ajouté" || { fail "Dépôt gh — échec" ; }
step "Installation de gh..."
sudo apt install -y gh -qq 2>/dev/null && \
ok "gh" || fail "gh"
fi
section "Configuration du shell par défaut"
if [ "$SHELL" != "/usr/bin/zsh" ]; then
step "Passage à zsh..."
chsh -s /usr/bin/zsh && ok "zsh défini comme shell par défaut" || warn "Échec chsh — à faire manuellement"
else
ok "zsh déjà défini comme shell par défaut"
fi

View File

@@ -0,0 +1,261 @@
#!/bin/bash
# ── violet-chaton : binaires GitHub ───────────────────────────────────────────
source "$(dirname "$0")/lib.sh"
BIN="$HOME/.local/bin"
ensure_dir "$BIN"
# Récupère le dernier tag d'un dépôt GitHub via la redirection web (sans API → pas de rate limit)
github_latest_tag() {
curl -sL -o /dev/null -w "%{url_effective}" \
"https://github.com/$1/releases/latest" 2>/dev/null \
| sed 's|.*/tag/||' | tr -d '\r\n'
}
install_binary() {
local name="$1"
local url="$2"
local extract="$3" # "tar:fichier", "zip:fichier", "direct", "tar-dir:dir/fichier"
step "Téléchargement de $name..."
local tmp=$(mktemp -d)
local archive="$tmp/archive"
if ! curl -sL "$url" -o "$archive"; then
fail "$name — échec du téléchargement"
rm -rf "$tmp"
return 1
fi
case "$extract" in
tar:*)
local file="${extract#tar:}"
tar xf "$archive" -C "$tmp" 2>/dev/null
local found; found=$(find "$tmp" -maxdepth 3 -name "$file" -type f | head -1)
[ -n "$found" ] && mv "$found" "$BIN/$name" && chmod +x "$BIN/$name"
;;
tar-dir:*)
local path="${extract#tar-dir:}"
tar xf "$archive" -C "$tmp" 2>/dev/null && \
cp "$tmp/$path" "$BIN/$name" && chmod +x "$BIN/$name"
;;
zip:*)
local file="${extract#zip:}"
unzip -o "$archive" -d "$tmp" 2>/dev/null && \
find "$tmp" -name "$file" -exec cp {} "$BIN/$name" \; && chmod +x "$BIN/$name"
;;
direct)
cp "$archive" "$BIN/$name" && chmod +x "$BIN/$name"
;;
esac
rm -rf "$tmp"
if [ -x "$BIN/$name" ]; then
ok "$name"
else
fail "$name — installation échouée"
fi
}
section "Installation des binaires manuels"
# lazygit
if has_cmd lazygit; then
ok "lazygit (déjà installé)"
else
LG_VER=$(github_latest_tag "jesseduffield/lazygit")
if [ -z "$LG_VER" ]; then
fail "lazygit — version introuvable"
else
install_binary "lazygit" \
"https://github.com/jesseduffield/lazygit/releases/download/${LG_VER}/lazygit_${LG_VER#v}_linux_x86_64.tar.gz" \
"tar:lazygit"
fi
fi
# yazi
if has_cmd yazi; then
ok "yazi (déjà installé)"
else
install_binary "yazi" \
"https://github.com/sxyazi/yazi/releases/latest/download/yazi-x86_64-unknown-linux-musl.zip" \
"zip:yazi"
fi
# glow
if has_cmd glow; then
ok "glow (déjà installé)"
else
GLOW_VER=$(github_latest_tag "charmbracelet/glow")
if [ -z "$GLOW_VER" ]; then
fail "glow — version introuvable"
else
install_binary "glow" \
"https://github.com/charmbracelet/glow/releases/download/${GLOW_VER}/glow_${GLOW_VER#v}_Linux_x86_64.tar.gz" \
"tar-dir:glow_${GLOW_VER#v}_Linux_x86_64/glow"
fi
fi
# tealdeer (tldr)
# La version n'est pas dans le nom du fichier → latest/download suffit, pas besoin de github_latest_tag
if [ -x "$BIN/tldr" ] && "$BIN/tldr" --version &>/dev/null; then
ok "tldr (déjà installé)"
else
install_binary "tldr" \
"https://github.com/tealdeer-rs/tealdeer/releases/latest/download/tealdeer-linux-x86_64-musl" \
"direct"
fi
# navi
if has_cmd navi; then
ok "navi (déjà installé)"
else
NAVI_VER=$(github_latest_tag "denisidoro/navi")
if [ -z "$NAVI_VER" ]; then
fail "navi — version introuvable"
else
install_binary "navi" \
"https://github.com/denisidoro/navi/releases/download/${NAVI_VER}/navi-${NAVI_VER}-x86_64-unknown-linux-musl.tar.gz" \
"tar:navi"
fi
fi
# pipes.sh
if [ -x "$BIN/pipes.sh" ]; then
ok "pipes.sh (déjà installé)"
else
step "Téléchargement de pipes.sh..."
curl -sL "https://raw.githubusercontent.com/pipeseroni/pipes.sh/master/pipes.sh" -o "$BIN/pipes.sh" && \
chmod +x "$BIN/pipes.sh" && ok "pipes.sh" || fail "pipes.sh"
fi
section "starship (prompt)"
if has_cmd starship; then
ok "starship (déjà installé)"
else
step "Installation de starship..."
_ts=$(mktemp)
curl -sS https://starship.rs/install.sh -o "$_ts" 2>/dev/null && \
sh "$_ts" --yes &>/dev/null && ok "starship" || fail "starship"
rm -f "$_ts"
fi
section "atuin (historique shell)"
if has_cmd atuin; then
ok "atuin (déjà installé)"
else
step "Installation de atuin..."
_ts=$(mktemp)
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh -o "$_ts" 2>/dev/null && \
sh "$_ts" &>/dev/null && ok "atuin" || fail "atuin"
rm -f "$_ts"
fi
section "fastfetch (system info)"
if has_cmd fastfetch; then
ok "fastfetch (déjà installé)"
else
step "Téléchargement de fastfetch (.deb)..."
tmp=$(mktemp -d)
if curl -sL "https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb" \
-o "$tmp/fastfetch.deb"; then
sudo dpkg -i "$tmp/fastfetch.deb" &>/dev/null && \
ok "fastfetch" || fail "fastfetch — échec dpkg -i"
else
fail "fastfetch — échec du téléchargement"
fi
rm -rf "$tmp"
fi
section "zinit (gestionnaire de plugins zsh)"
if [ ! -d "$HOME/.local/share/zinit/zinit.git" ]; then
step "Installation de zinit..."
mkdir -p "$HOME/.local/share/zinit"
git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" -q && \
ok "zinit" || fail "zinit"
else
ok "zinit (déjà installé)"
fi
section "Mise à jour du cache tldr"
step "Téléchargement des pages..."
if "$BIN/tldr" --update 2>/dev/null || { sleep 3 && "$BIN/tldr" --update 2>/dev/null; }; then
ok "Cache tldr mis à jour"
else
warn "Échec mise à jour tldr — relancer manuellement : tldr --update"
fi
# ── Nerd Fonts ─────────────────────────────────────────────────────────────────
section "Nerd Fonts (JetBrainsMono NL + 0xProto)"
FONTS_DIR="$HOME/.local/share/fonts/NerdFonts"
ensure_dir "$FONTS_DIR"
install_font() {
local name="$1"
local url="$2"
local marker="$3" # nom d'un fichier font attendu après install
if [ -f "$FONTS_DIR/$marker" ]; then
ok "$name (déjà installée)"
return
fi
step "Téléchargement de $name..."
local tmp=$(mktemp -d)
if curl -sL "$url" -o "$tmp/font.zip"; then
unzip -o "$tmp/font.zip" -d "$tmp/extracted" '*.ttf' '*.otf' &>/dev/null
find "$tmp/extracted" -type f \( -name "*.ttf" -o -name "*.otf" \) \
-exec cp {} "$FONTS_DIR/" \;
ok "$name"
else
fail "$name — échec du téléchargement"
fi
rm -rf "$tmp"
}
install_font "JetBrainsMono NL" \
"https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip" \
"JetBrainsMonoNLNerdFont-Regular.ttf"
install_font "0xProto" \
"https://github.com/ryanoasis/nerd-fonts/releases/latest/download/0xProto.zip" \
"0xProtoNerdFont-Regular.ttf"
step "Mise à jour du cache de polices (fc-cache)..."
fc-cache -f "$FONTS_DIR" &>/dev/null && ok "Cache polices" || warn "fc-cache échoué"
# ── candy-icons ────────────────────────────────────────────────────────────────
section "candy-icons (thème d'icônes)"
ICONS_DIR="$HOME/.local/share/icons"
ensure_dir "$ICONS_DIR"
if [ -d "$ICONS_DIR/candy-icons-master" ]; then
ok "candy-icons (déjà installé)"
else
step "Téléchargement de candy-icons..."
tmp=$(mktemp -d)
if curl -sL "https://github.com/EliverLara/candy-icons/archive/refs/heads/master.zip" \
-o "$tmp/candy.zip"; then
unzip -o "$tmp/candy.zip" -d "$tmp/extracted" &>/dev/null
mv "$tmp/extracted/candy-icons-master" "$ICONS_DIR/candy-icons-master"
ok "candy-icons"
else
fail "candy-icons — échec du téléchargement"
fi
rm -rf "$tmp"
fi
step "Mise à jour du cache icônes (gtk-update-icon-cache)..."
gtk-update-icon-cache -f "$ICONS_DIR/candy-icons-master" &>/dev/null && \
ok "Cache icônes mis à jour" || warn "gtk-update-icon-cache échoué"
# ── uv ─────────────────────────────────────────────────────────────────────────
section "uv (gestionnaire Python + uvx)"
if has_cmd uv; then
ok "uv (déjà installé)"
else
step "Installation de uv..."
_ts=$(mktemp)
curl -LsSf https://astral.sh/uv/install.sh -o "$_ts" 2>/dev/null && \
sh "$_ts" &>/dev/null && ok "uv (uvx inclus)" || fail "uv"
rm -f "$_ts"
fi

View File

@@ -0,0 +1,241 @@
#!/bin/bash
# ── violet-chaton : déploiement des configs et thèmes ─────────────────────────
source "$(dirname "$0")/lib.sh"
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
THEMES="$SCRIPT_DIR/themes"
CONFIGS="$SCRIPT_DIR/configs"
BACKUP_DIR="$HOME/.config/violet-chaton-backups/$(date +%Y%m%d-%H%M%S)"
deploy_file() {
local src="$1"
local dst="$2"
ensure_dir "$(dirname "$dst")"
if [ -f "$dst" ]; then
local rel="${dst#"$HOME/"}"
ensure_dir "$BACKUP_DIR/$(dirname "$rel")"
cp "$dst" "$BACKUP_DIR/$rel" 2>/dev/null
fi
if cp "$src" "$dst" 2>/dev/null; then
ok "$(basename "$dst")"
else
fail "$(basename "$dst")"
fi
}
# ── Configs shell ──────────────────────────────────────────────────────────────
section "Configs shell"
deploy_file "$CONFIGS/zshrc" "$HOME/.zshrc"
deploy_file "$CONFIGS/bashrc" "$HOME/.bashrc"
# Préserver user.name et user.email avant d'écraser le gitconfig
_GIT_NAME=$(git config --global user.name 2>/dev/null)
_GIT_EMAIL=$(git config --global user.email 2>/dev/null)
deploy_file "$CONFIGS/gitconfig" "$HOME/.gitconfig"
if [ -n "$_GIT_NAME" ]; then
git config --global user.name "$_GIT_NAME"
ok "user.name restauré : $_GIT_NAME"
fi
if [ -n "$_GIT_EMAIL" ]; then
git config --global user.email "$_GIT_EMAIL"
ok "user.email restauré : $_GIT_EMAIL"
fi
# ── Configs outils ─────────────────────────────────────────────────────────────
section "Configs outils"
deploy_file "$CONFIGS/starship.toml" "$HOME/.config/starship.toml"
deploy_file "$CONFIGS/bat.conf" "$HOME/.config/bat/config"
deploy_file "$CONFIGS/btop.conf" "$HOME/.config/btop/btop.conf"
deploy_file "$CONFIGS/fastfetch.jsonc" "$HOME/.config/fastfetch/config.jsonc"
deploy_file "$CONFIGS/atuin.toml" "$HOME/.config/atuin/config.toml"
deploy_file "$CONFIGS/lazygit.yml" "$HOME/.config/lazygit/config.yml"
deploy_file "$CONFIGS/yazi.toml" "$HOME/.config/yazi/yazi.toml"
deploy_file "$CONFIGS/glow.yml" "$HOME/.config/glow/glow.yml"
# ── Thèmes CLI ─────────────────────────────────────────────────────────────────
section "Thèmes violet-chaton (CLI)"
deploy_file "$THEMES/violet-chaton.theme.css" \
"$HOME/.config/vesktop/themes/violet-chaton.theme.css"
# Flatpak — uniquement si Vesktop flatpak est déjà installé
if [ -d "$HOME/.var/app/dev.vencord.Vesktop" ]; then
deploy_file "$THEMES/violet-chaton.theme.css" \
"$HOME/.var/app/dev.vencord.Vesktop/config/vesktop/themes/violet-chaton.theme.css"
fi
deploy_file "$THEMES/violet-chaton-bat.tmTheme" "$HOME/.config/bat/themes/violet-chaton.tmTheme"
deploy_file "$THEMES/violet-chaton-btop.theme" "$HOME/.config/btop/themes/violet-chaton.theme"
deploy_file "$THEMES/violet-chaton-atuin.toml" "$HOME/.config/atuin/themes/violet-chaton.toml"
deploy_file "$THEMES/violet-chaton-cava.conf" "$HOME/.config/cava/config"
deploy_file "$THEMES/violet-chaton-yazi.toml" "$HOME/.config/yazi/theme.toml"
deploy_file "$THEMES/violet-chaton-ls-colors.sh" "$HOME/.local/share/violet-chaton/violet-chaton-ls-colors.sh"
# ── COSMIC Desktop ─────────────────────────────────────────────────────────────
section "COSMIC — thème, terminal et toolkit"
COSMIC_SRC="$THEMES/cosmic"
COSMIC_DST="$HOME/.config/cosmic"
step "COSMIC Theme Dark..."
backup_dir "$COSMIC_DST/com.system76.CosmicTheme.Dark/v1"
ensure_dir "$COSMIC_DST/com.system76.CosmicTheme.Dark/v1"
if cp "$COSMIC_SRC/com.system76.CosmicTheme.Dark/v1/"* "$COSMIC_DST/com.system76.CosmicTheme.Dark/v1/" 2>/dev/null; then
ok "CosmicTheme.Dark"
else
fail "CosmicTheme.Dark"
fi
step "COSMIC Theme Mode (dark)..."
backup_dir "$COSMIC_DST/com.system76.CosmicTheme.Mode/v1"
ensure_dir "$COSMIC_DST/com.system76.CosmicTheme.Mode/v1"
if cp "$COSMIC_SRC/com.system76.CosmicTheme.Mode/v1/is_dark" "$COSMIC_DST/com.system76.CosmicTheme.Mode/v1/" 2>/dev/null; then
ok "CosmicTheme.Mode"
else
fail "CosmicTheme.Mode"
fi
step "COSMIC Terminal..."
backup_dir "$COSMIC_DST/com.system76.CosmicTerm/v1"
ensure_dir "$COSMIC_DST/com.system76.CosmicTerm/v1"
if cp "$COSMIC_SRC/com.system76.CosmicTerm/v1/"* "$COSMIC_DST/com.system76.CosmicTerm/v1/" 2>/dev/null; then
ok "CosmicTerm"
else
fail "CosmicTerm"
fi
# ── GTK3 — thème violet-chaton ─────────────────────────────────────────────
section "GTK3 — thème violet-chaton"
ensure_dir "$HOME/.config/gtk-3.0"
deploy_file "$THEMES/violet-chaton-gtk.css" "$HOME/.config/gtk-3.0/gtk.css"
# ── Nemo — gestionnaire de fichiers ────────────────────────────────────────
section "Nemo — configuration et thème"
step "Nemo comme gestionnaire de fichiers par défaut..."
if has_cmd xdg-mime; then
xdg-mime default nemo.desktop inode/directory 2>/dev/null && \
xdg-mime default nemo.desktop application/x-gnome-saved-search 2>/dev/null && \
ok "Nemo défini par défaut" || warn "xdg-mime Nemo échoué"
else
warn "xdg-mime non disponible — à faire manuellement"
fi
step "Préférences Nemo (gsettings)..."
if has_cmd gsettings; then
gsettings set org.nemo.preferences default-folder-viewer 'icon-view' 2>/dev/null
gsettings set org.nemo.preferences show-hidden-files false 2>/dev/null
gsettings set org.nemo.preferences show-image-thumbnails 'always' 2>/dev/null
gsettings set org.nemo.icon-view default-zoom-level 'standard' 2>/dev/null
gsettings set org.nemo.list-view default-zoom-level 'small' 2>/dev/null
ok "Préférences Nemo appliquées"
else
warn "gsettings non disponible — préférences Nemo à configurer manuellement"
fi
step "Application du thème d'icônes candy-icons (GTK)..."
if has_cmd gsettings; then
gsettings set org.gnome.desktop.interface icon-theme 'candy-icons-master' 2>/dev/null && \
ok "icon-theme candy-icons-master (gsettings)" || warn "gsettings icon-theme échoué"
else
warn "gsettings non disponible — thème d'icônes GTK à appliquer manuellement"
fi
step "COSMIC Toolkit (polices, icônes)..."
backup_dir "$COSMIC_DST/com.system76.CosmicTk/v1"
ensure_dir "$COSMIC_DST/com.system76.CosmicTk/v1"
if cp "$COSMIC_SRC/com.system76.CosmicTk/v1/"* "$COSMIC_DST/com.system76.CosmicTk/v1/" 2>/dev/null; then
ok "CosmicTk"
else
fail "CosmicTk"
fi
# ── Vivaldi ─────────────────────────────────────────────────────────────────────
section "Vivaldi — thème Rice Violet-Chaton"
VIVALDI_PREFS="$HOME/.config/vivaldi/Default/Preferences"
if [ ! -f "$VIVALDI_PREFS" ]; then
echo ""
echo -e "${PINK}${BOLD} ┌──────────────────────────────────────────────────────────┐${RESET}"
echo -e "${PINK}${BOLD} │ Vivaldi n'a pas encore été lancé. │${RESET}"
echo -e "${PINK}${TEXT}Lance Vivaldi maintenant, attends qu'il démarre,${PINK}${RESET}"
echo -e "${PINK}${TEXT}puis ferme-le et appuie sur Entrée pour continuer.${PINK}${RESET}"
echo -e "${PINK}${BOLD} └──────────────────────────────────────────────────────────┘${RESET}"
echo ""
read -rp " → Appuie sur Entrée une fois Vivaldi fermé..." _
echo ""
fi
if [ ! -f "$VIVALDI_PREFS" ]; then
warn "Preferences Vivaldi toujours introuvable — thème non injecté"
else
step "Injection du thème Rice Violet-Chaton..."
python3 - "$VIVALDI_PREFS" "$THEMES/violet-chaton-vivaldi.json" <<'PYEOF'
import json, sys
prefs_path = sys.argv[1]
theme_path = sys.argv[2]
with open(prefs_path, 'r') as f:
prefs = json.load(f)
with open(theme_path, 'r') as f:
new_themes = json.load(f)
theme = new_themes[0]
theme_id = theme['id']
# Injecter dans vivaldi.themes.user (dédoublonner par id)
user_themes = prefs.setdefault('vivaldi', {}).setdefault('themes', {}).setdefault('user', [])
user_themes = [t for t in user_themes if t.get('id') != theme_id]
user_themes.append(theme)
prefs['vivaldi']['themes']['user'] = user_themes
# Activer le thème (dark et light schedule)
prefs.setdefault('vivaldi', {}).setdefault('theme', {}).setdefault('schedule', {}).setdefault('o_s', {})
prefs['vivaldi']['theme']['schedule']['o_s']['light'] = theme_id
prefs['vivaldi']['theme']['schedule']['o_s']['dark'] = theme_id
with open(prefs_path, 'w') as f:
json.dump(prefs, f, separators=(',', ':'))
print("ok")
PYEOF
if [ $? -eq 0 ]; then
ok "Vivaldi thème injecté"
info "→ Redémarre Vivaldi pour appliquer le thème"
else
fail "Vivaldi injection échouée"
fi
fi
# ── Logo fastfetch ─────────────────────────────────────────────────────────────
section "Logo fastfetch"
if [ -f "$SCRIPT_DIR/assets/violet-chaton-logo.png" ]; then
deploy_file "$SCRIPT_DIR/assets/violet-chaton-logo.png" "$HOME/.config/fastfetch/violet-chaton-logo.png"
else
warn "Logo non trouvé dans assets/ — fastfetch démarrera sans logo"
fi
# ── Rebuild caches ─────────────────────────────────────────────────────────────
section "Rebuild des caches"
step "Cache bat (thème violet-chaton)..."
if has_cmd batcat; then
batcat cache --build &>/dev/null && ok "bat cache" || fail "bat cache"
fi
step "PATH ~/.local/bin..."
export PATH="$HOME/.local/bin:$PATH"
# ── Étapes manuelles ───────────────────────────────────────────────────────────
echo ""
echo -e "${YELLOW}${BOLD} ╔══════════════════════════════════════════════════════════╗${RESET}"
echo -e "${YELLOW}${BOLD} ║ Étapes manuelles requises après install ║${RESET}"
echo -e "${YELLOW}${BOLD} ╠══════════════════════════════════════════════════════════╣${RESET}"
echo -e "${YELLOW}${TEXT}1. Vivaldi : lance le navigateur une fois avant install${YELLOW}${RESET}"
echo -e "${YELLOW}${MUTED} puis relance ce script si le thème n'est pas injecté${YELLOW}${RESET}"
echo -e "${YELLOW}${BOLD} ╚══════════════════════════════════════════════════════════╝${RESET}"
echo ""
if [ -d "$BACKUP_DIR" ]; then
echo -e " ${MUTED}Configs précédentes sauvegardées dans :${RESET}"
echo -e " ${TEXT}$BACKUP_DIR${RESET}"
echo ""
fi

136
INSTALL/scripts/lib.sh Executable file
View File

@@ -0,0 +1,136 @@
#!/bin/bash
# ── violet-chaton : fonctions partagées ───────────────────────────────────────
PINK='\033[38;2;255;121;198m'
PURPLE='\033[38;2;231;156;254m'
CYAN='\033[38;2;139;233;253m'
GREEN='\033[38;2;166;227;161m'
YELLOW='\033[38;2;249;226;175m'
RED='\033[38;2;243;139;168m'
MUTED='\033[38;2;108;112;134m'
TEXT='\033[38;2;248;248;242m'
BOLD='\033[1m'
RESET='\033[0m'
# ── Log ────────────────────────────────────────────────────────────────────────
# INSTALL_LOG peut être pré-exporté par install.sh pour que tous les sous-scripts
# partagent le même fichier. Sinon, chaque script crée le sien.
: "${INSTALL_LOG:=$HOME/violet-chaton-install-$(date +%Y%m%d-%H%M%S).log}"
export INSTALL_LOG
_log() {
printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$1" >> "$INSTALL_LOG"
}
# ── Bannières ─────────────────────────────────────────────────────────────────
banner() {
echo ""
echo -e "${PINK}${BOLD} ╔══════════════════════════════════════════════════════════╗${RESET}"
echo -e "${PINK}${BOLD} ║ ║${RESET}"
echo -e "${PINK}${BOLD}${PURPLE}░░ violet-chaton — setup automatique ░░${PINK} q:D ║${RESET}"
echo -e "${PINK}${BOLD} ║ ║${RESET}"
echo -e "${PINK}${BOLD} ╚══════════════════════════════════════════════════════════╝${RESET}"
echo ""
_log "════════════════════════════════════════"
_log " violet-chaton — installation démarrée"
_log "════════════════════════════════════════"
}
banner_done() {
_log ""
_log "════════════════════════════════════════"
_log " Installation terminée"
_log "════════════════════════════════════════"
echo ""
echo -e "${CYAN}${BOLD} ╔══════════════════════════════════════════════════════════╗${RESET}"
echo -e "${CYAN}${BOLD} ║ ║${RESET}"
echo -e "${CYAN}${BOLD}${GREEN}✓ Installation terminée avec succès !${CYAN}${RESET}"
echo -e "${CYAN}${BOLD}${MUTED}Ouvre un nouveau terminal pour voir le résultat.${CYAN}${RESET}"
echo -e "${CYAN}${BOLD} ║ ║${RESET}"
echo -e "${CYAN}${BOLD} ╚══════════════════════════════════════════════════════════╝${RESET}"
echo ""
echo -e " ${MUTED}Log complet :${RESET} ${TEXT}$INSTALL_LOG${RESET}"
echo ""
}
# ── Fonctions de sortie (terminal + log) ───────────────────────────────────────
section() {
echo ""
echo -e "${PURPLE}${BOLD} ┌─ $1 ${RESET}"
_log ""
_log "── $1"
}
step() {
echo -e "${MUTED}${CYAN}${RESET} $1"
_log "$1"
}
ok() {
echo -e "${MUTED}${GREEN}${RESET} $1"
_log "$1"
}
fail() {
echo -e "${MUTED}${RED}${RESET} $1"
_log " ✗ ERREUR : $1"
}
warn() {
echo -e "${MUTED}${YELLOW}!${RESET} $1"
_log " ! AVERT : $1"
}
info() {
echo -e "${MUTED}${MUTED}$1${RESET}"
_log " $1"
}
# ── Utilitaires ───────────────────────────────────────────────────────────────
has_cmd() {
command -v "$1" &>/dev/null
}
ensure_dir() {
mkdir -p "$1"
}
backup_dir() {
local dir="$1"
[ -d "$dir" ] || return 0
# BACKUP_DIR est défini par 03-deploy-configs.sh
[ -z "$BACKUP_DIR" ] && return 0
local rel="${dir#"$HOME/"}"
ensure_dir "$BACKUP_DIR/$rel"
cp -r "$dir/." "$BACKUP_DIR/$rel/" 2>/dev/null
}
show_summary() {
local log="$INSTALL_LOG"
[ -f "$log" ] || return
local successes errors warnings
successes=$(grep -c " ✓ " "$log" 2>/dev/null) || true; successes=${successes:-0}
errors=$(grep -c " ✗ ERREUR" "$log" 2>/dev/null) || true; errors=${errors:-0}
warnings=$(grep -c " ! AVERT" "$log" 2>/dev/null) || true; warnings=${warnings:-0}
echo -e "${PURPLE}${BOLD} ┌─ Résumé ────────────────────────────────────────────────────${RESET}"
echo -e "${GREEN}${successes} réussis${RESET} ${YELLOW}! ${warnings} avertissements${RESET} ${RED}${errors} erreurs${RESET}"
if [ "${errors:-0}" -gt 0 ] 2>/dev/null; then
echo -e " │"
echo -e "${RED}Erreurs :${RESET}"
grep " ✗ ERREUR" "$log" | sed 's/.*✗ ERREUR : //' | while IFS= read -r line; do
echo -e "${RED}${RESET} $line"
done
fi
if [ "${warnings:-0}" -gt 0 ] 2>/dev/null; then
echo -e " │"
echo -e "${YELLOW}Avertissements :${RESET}"
grep " ! AVERT" "$log" | sed 's/.*! AVERT : //' | while IFS= read -r line; do
echo -e "${YELLOW}!${RESET} $line"
done
fi
echo ""
}