Files
Hyprland-Config-FWS/install.sh
T
BlackAngelTV 6a65913c2c feat: piloter la lecture en cours depuis la barre et assortir les notifications
La barre ne disait rien de la musique qui joue, et les notifications gardaient
le style par défaut de mako, sans rapport avec le reste du bureau.

Waybar gagne un module média (pochette téléchargée puis mise en cache, titre,
artiste et temps) et un panneau flottant ouvert au clic ou par SUPER+M, avec
une position déplaçable, les commandes de lecture et une croix pour fermer ;
mako reprend la palette violette et se place sous la barre.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-09-16 23:23:59 +02:00

306 lines
17 KiB
Bash
Executable File

#!/usr/bin/env bash
# ╔══════════════════════════════════════════════════════════════╗
# ║ 💜 violet-dotfiles — installateur du thème VIOLET ║
# ║ ║
# ║ Usage : ║
# ║ ./install.sh configs utilisateur (Hypr, ║
# ║ Waybar, mako, wofi, kitty, ║
# ║ btop, GTK, zsh, fond d'écran)║
# ║ ./install.sh --bash + prompt bash dans ~/.bashrc ║
# ║ ./install.sh --grub + thème GRUB (demande sudo) ║
# ║ ./install.sh --sddm + thème SDDM (demande sudo) ║
# ║ ./install.sh --install-deps + paquets manquants (pacman) ║
# ║ ./install.sh --all tout ce qui précède ║
# ║ ║
# ║ Les fichiers existants sont sauvegardés dans ║
# ║ ~/.violet-backup-<date>/ avant d'être remplacés. ║
# ╚══════════════════════════════════════════════════════════════╝
set -euo pipefail
SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HOME_DIR="${HOME:-$HOME}"
DO_BASH=false
DO_GRUB=false
DO_SDDM=false
DO_DEPS=false
for arg in "$@"; do
case "$arg" in
--bash) DO_BASH=true ;;
--grub) DO_GRUB=true ;;
--sddm) DO_SDDM=true ;;
--install-deps) DO_DEPS=true ;;
--all) DO_BASH=true; DO_GRUB=true; DO_SDDM=true; DO_DEPS=true ;;
*) echo "⚠ Option inconnue : $arg (voir l'en-tête du script)" ;;
esac
done
# ── Couleurs pour l'affichage ───────────────────────────────────────
MAUVE=$'\e[38;2;203;166;247m'
RESET=$'\e[0m'
say() { printf '%s💜 %s%s\n' "$MAUVE" "$*" "$RESET"; }
warn() { printf '⚠ %s\n' "$*"; }
# ── Vérifications ───────────────────────────────────────────────────
if [[ ! -d "$SRC_DIR/hypr" ]]; then
echo "Erreur : dossier hypr/ introuvable à côté du script."
echo "Lance install.sh depuis le dossier violet-dotfiles."
exit 1
fi
# ── Sauvegarde des fichiers existants ───────────────────────────────
BACKUP_DIR="$HOME_DIR/.violet-backup-$(date +%Y%m%d-%H%M%S)"
backup() {
[[ -e "$1" ]] || return 0
mkdir -p "$BACKUP_DIR"
local rel="${1#$HOME_DIR/}"
mkdir -p "$BACKUP_DIR/$(dirname "$rel")"
mv "$1" "$BACKUP_DIR/$rel"
warn "config existante sauvegardée → ~/.violet-backup-*/$rel"
}
# ── Copie d'un dossier avec substitution ────────────────────────────
install_dir() { # install_dir <src> <dst> [sed-remplacements...]
local src="$1" dst="$2"; shift 2
mkdir -p "$dst"
if (( $# > 0 )); then
# copie avec substitutions : chaque argument = "recherche|remplacement"
while IFS= read -r -d '' f; do
local rel="${f#$src/}" target="$dst/$rel"
mkdir -p "$(dirname "$target")"
local sed_args=()
for pair in "$@"; do
sed_args+=(-e "s|${pair%%|*}|${pair#*|}|g")
done
sed "${sed_args[@]}" "$f" > "$target"
done < <(find "$src" -type f -print0)
else
cp -r "$src"/. "$dst"/
fi
}
say "Installation du thème violet 💜"
say "Source : $SRC_DIR"
say "Cible : $HOME_DIR"
# ═══════════════════════════════════════════════════════════════════
# 1. Fond d'écran → ~/Images/Banner.png
# ═══════════════════════════════════════════════════════════════════
WALLPAPER_DST="$HOME_DIR/Images/Banner.png"
mkdir -p "$HOME_DIR/Images"
if [[ -f "$SRC_DIR/wallpapers/Banner.png" ]]; then
backup "$WALLPAPER_DST"
cp "$SRC_DIR/wallpapers/Banner.png" "$WALLPAPER_DST"
say "fond d'écran → $WALLPAPER_DST"
else
WALLPAPER_DST="/chemin/vers/ton/fond.png"
warn "wallpapers/Banner.png absent : indique le chemin de ton fond d'écran dans hypr/hyprpaper.conf"
fi
# ═══════════════════════════════════════════════════════════════════
# 2. Hyprland (hyprland.conf, hyprlock, hyprpaper)
# ═══════════════════════════════════════════════════════════════════
HYPR_DST="$HOME_DIR/.config/hypr"
for f in hyprland.conf hyprlock.conf hyprlock-violet.conf; do
backup "$HYPR_DST/$f"
done
mkdir -p "$HYPR_DST"
cp "$SRC_DIR/hypr/hyprland.conf" "$HYPR_DST/"
cp "$SRC_DIR/hypr/hyprlock.conf" "$HYPR_DST/"
cp "$SRC_DIR/hypr/hyprlock-violet.conf" "$HYPR_DST/"
# hyprpaper : chemin du fond d'écran substitué
backup "$HYPR_DST/hyprpaper.conf"
sed -e "s|__WALLPAPER__|$WALLPAPER_DST|g" \
"$SRC_DIR/hypr/hyprpaper.conf" > "$HYPR_DST/hyprpaper.conf"
# hyprlock : personnalise l'écran avec le nom de l'utilisateur réel
if [[ "$USER" != "damien" ]]; then
sed -i "s/Bonjour damien 💜/Bonjour $USER 💜/" "$HYPR_DST/hyprlock.conf" || true
fi
say "config Hyprland → $HYPR_DST"
# ═══════════════════════════════════════════════════════════════════
# 3. Waybar
# ═══════════════════════════════════════════════════════════════════
WAYBAR_DST="$HOME_DIR/.config/waybar"
SCRIPTS_DST="$WAYBAR_DST/scripts"
LOGO_DST="$WAYBAR_DST/icons/logo.png"
backup "$WAYBAR_DST/config"
backup "$WAYBAR_DST/style.css"
backup "$WAYBAR_DST/icons/logo.png"
mkdir -p "$WAYBAR_DST/icons" "$SCRIPTS_DST"
# __WAYBAR_SCRIPTS__ = chemin ABSOLU : Waybar lance ses commandes sans passer
# par un shell, donc ni « ~ » ni « $HOME » n'y sont développés.
sed -e "s|__WAYBAR_SCRIPTS__|$SCRIPTS_DST|g" \
"$SRC_DIR/waybar/config" > "$WAYBAR_DST/config"
cp "$SRC_DIR/waybar/icons/logo.png" "$LOGO_DST"
sed -e "s|__WAYBAR_LOGO__|$LOGO_DST|g" \
"$SRC_DIR/waybar/style.css" > "$WAYBAR_DST/style.css"
# Panneau multimédia + pochette : appelés par la barre et par SUPER+M.
install -m 755 "$SRC_DIR/waybar/scripts/media-cover" "$SCRIPTS_DST/media-cover"
install -m 755 "$SRC_DIR/waybar/scripts/media-panel" "$SCRIPTS_DST/media-panel"
say "config Waybar + scripts média → $WAYBAR_DST"
# ═══════════════════════════════════════════════════════════════════
# 3bis. Notifications (mako)
# ═══════════════════════════════════════════════════════════════════
MAKO_DST="$HOME_DIR/.config/mako"
backup "$MAKO_DST/config"
install_dir "$SRC_DIR/mako" "$MAKO_DST"
say "thème des notifications → $MAKO_DST/config"
# ═══════════════════════════════════════════════════════════════════
# 4. wofi, kitty, btop, GTK
# ═══════════════════════════════════════════════════════════════════
backup "$HOME_DIR/.config/wofi/config"; backup "$HOME_DIR/.config/wofi/style.css"
install_dir "$SRC_DIR/wofi" "$HOME_DIR/.config/wofi"
say "config wofi → ~/.config/wofi"
backup "$HOME_DIR/.config/kitty/kitty.conf"
install_dir "$SRC_DIR/kitty" "$HOME_DIR/.config/kitty"
say "config kitty → ~/.config/kitty"
backup "$HOME_DIR/.config/btop/themes/violet.theme"
install_dir "$SRC_DIR/btop" "$HOME_DIR/.config/btop"
say "thème btop → ~/.config/btop/themes/violet.theme"
# active le thème violet dans btop (s'il existe déjà une config)
if [[ -f "$HOME_DIR/.config/btop/btop.conf" ]] && ! grep -q 'color_theme = "violet"' "$HOME_DIR/.config/btop/btop.conf" 2>/dev/null; then
sed -i 's|^color_theme = .*|color_theme = "violet"|' "$HOME_DIR/.config/btop/btop.conf" 2>/dev/null || true
fi
backup "$HOME_DIR/.config/gtk-3.0/settings.ini"
backup "$HOME_DIR/.config/gtk-4.0/settings.ini"
install_dir "$SRC_DIR/gtk/gtk-3.0" "$HOME_DIR/.config/gtk-3.0"
install_dir "$SRC_DIR/gtk/gtk-4.0" "$HOME_DIR/.config/gtk-4.0"
say "réglages GTK → ~/.config/gtk-3.0 et gtk-4.0"
# ═══════════════════════════════════════════════════════════════════
# 5. Prompt zsh
# ═══════════════════════════════════════════════════════════════════
mkdir -p "$HOME_DIR/.config/zsh"
backup "$HOME_DIR/.config/zsh/kali-violet.zshrc"
cp "$SRC_DIR/zsh/kali-violet.zshrc" "$HOME_DIR/.config/zsh/kali-violet.zshrc"
if [[ ! -f "$HOME_DIR/.zshrc" ]]; then
touch "$HOME_DIR/.zshrc"
fi
if ! grep -q "kali-violet.zshrc" "$HOME_DIR/.zshrc"; then
cat >> "$HOME_DIR/.zshrc" <<'EOF'
# 💜 Thème violet — prompt Kali (installé par violet-dotfiles)
[[ -f "$HOME/.config/zsh/kali-violet.zshrc" ]] && source "$HOME/.config/zsh/kali-violet.zshrc"
EOF
fi
say "prompt zsh → ~/.config/zsh/kali-violet.zshrc (source ajoutée à ~/.zshrc)"
# ═══════════════════════════════════════════════════════════════════
# 6. Prompt bash (option --bash)
# ═══════════════════════════════════════════════════════════════════
if $DO_BASH; then
mkdir -p "$HOME_DIR/.config/bash"
backup "$HOME_DIR/.config/bash/violet-prompt.bash"
cp "$SRC_DIR/bash/violet-prompt.bash" "$HOME_DIR/.config/bash/violet-prompt.bash"
if [[ ! -f "$HOME_DIR/.bashrc" ]]; then
touch "$HOME_DIR/.bashrc"
fi
if ! grep -q "violet-prompt.bash" "$HOME_DIR/.bashrc"; then
cat >> "$HOME_DIR/.bashrc" <<'EOF'
# 💜 Thème violet — prompt Kali (installé par violet-dotfiles)
[[ -f "$HOME/.config/bash/violet-prompt.bash" ]] && source "$HOME/.config/bash/violet-prompt.bash"
EOF
say "prompt bash → ~/.config/bash/violet-prompt.bash (source ajoutée à ~/.bashrc)"
else
say "prompt bash déjà en place"
fi
fi
# ═══════════════════════════════════════════════════════════════════
# 7. Thème GRUB (option --grub, sudo requis)
# ═══════════════════════════════════════════════════════════════════
if $DO_GRUB; then
if [[ ! -f "$SRC_DIR/grub/violet/theme.txt" ]]; then
warn "grub/violet/theme.txt introuvable — étape GRUB ignorée"
else
SUDO=""
[[ $EUID -ne 0 ]] && SUDO="sudo"
say "installation du thème GRUB violet (sudo requis)…"
$SUDO mkdir -p /boot/grub/themes
$SUDO rm -rf /boot/grub/themes/violet
$SUDO cp -r "$SRC_DIR/grub/violet" /boot/grub/themes/
# GRUB_THEME : remplace la ligne existante ou l'ajoute
if $SUDO grep -q '^GRUB_THEME=' /etc/default/grub; then
$SUDO sed -i 's|^GRUB_THEME=.*|GRUB_THEME="/boot/grub/themes/violet/theme.txt"|' /etc/default/grub
else
printf '\n# Thème violet (généré automatiquement)\nGRUB_THEME="/boot/grub/themes/violet/theme.txt"\n' | $SUDO tee -a /etc/default/grub >/dev/null
fi
if ! $SUDO grep -q '^GRUB_GFXMODE=' /etc/default/grub; then
echo 'GRUB_GFXMODE=1920x1080,auto' | $SUDO tee -a /etc/default/grub >/dev/null
fi
$SUDO grub-mkconfig -o /boot/grub/grub.cfg
say "thème GRUB installé (redémarre pour le voir 💜)"
fi
fi
# ═══════════════════════════════════════════════════════════════════
# 8. Thème SDDM (option --sddm, sudo requis)
# ═══════════════════════════════════════════════════════════════════
if $DO_SDDM; then
if [[ -d "$SRC_DIR/sddm/catppuccin-mocha-mauve" ]]; then
SUDO=""
[[ $EUID -ne 0 ]] && SUDO="sudo"
say "installation du thème SDDM (sudo requis)…"
$SUDO mkdir -p /usr/share/sddm/themes
$SUDO rm -rf /usr/share/sddm/themes/catppuccin-mocha-mauve
$SUDO cp -r "$SRC_DIR/sddm/catppuccin-mocha-mauve" /usr/share/sddm/themes/
$SUDO mkdir -p /etc/sddm.conf.d
$SUDO cp "$SRC_DIR/sddm/10-fws.conf" /etc/sddm.conf.d/10-fws.conf
say "thème SDDM installé (visible au prochain écran de connexion)"
else
warn "sddm/catppuccin-mocha-mauve introuvable — étape SDDM ignorée"
fi
fi
# ═══════════════════════════════════════════════════════════════════
# 9. Dépendances (option --install-deps, paquets Arch)
# ═══════════════════════════════════════════════════════════════════
DEPS=(hyprland hyprlock hyprpaper waybar wofi kitty btop mako grim slurp wl-clipboard \
playerctl pavucontrol noto-fonts ttf-nerd-fonts-symbols network-manager-applet \
blueman polkit-gnome dolphin python-gobject gtk4 curl)
if $DO_DEPS; then
if command -v pacman >/dev/null 2>&1; then
say "installation des dépendances (pacman)…"
sudo pacman -S --needed --noconfirm "${DEPS[@]}"
else
warn "pas de pacman détecté — installe manuellement : ${DEPS[*]}"
warn "équivalents Debian/Ubuntu : hyprland waybar wofi kitty btop grim slurp wl-clipboard playerctl pavucontrol fonts-noto-core fonts-noto-color-emoji blueman policykit-1-gnome dolphin"
fi
fi
# ═══════════════════════════════════════════════════════════════════
# 10. Scripts FWS manquants (rappel)
# ═══════════════════════════════════════════════════════════════════
MISSING=()
for cmd in fws-powermenu fws-keys fws-updates-check fws-update fws-brightness fws-hello; do
command -v "$cmd" >/dev/null 2>&1 || MISSING+=("$cmd")
done
if (( ${#MISSING[@]} > 0 )); then
echo
warn "Commandes FWS absentes (scripts de la distro FWS, pas de panique) :"
warn " ${MISSING[*]}"
warn "→ Les raccourcis/boutons qui les appellent ne feront rien tant qu'elles"
warn " n'existent pas. Voir README.md § « Dépendances FWS » pour les remplacer."
fi
# ═══════════════════════════════════════════════════════════════════
# Fin
# ═══════════════════════════════════════════════════════════════════
echo
say "✔ Terminé !"
say "Recharge Hyprland (SUPER+SHIFT+C ou hyprctl reload) et redémarre"
say "waybar pour voir le thème : killall waybar ; waybar &"
say "notifications (mako déjà lancé) : makoctl reload"
if [[ -d "$BACKUP_DIR" ]]; then
say "Anciennes configs : ~/.violet-backup-*/ (supprimables quand tout va bien)"
fi