#!/bin/bash set -euo pipefail SETUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PACKAGES_FILE="$SETUP_DIR/packages.txt" # shellcheck source=../lib/common.sh source "$SETUP_DIR/../lib/common.sh" # --------------------------------------------------------------------------- # Create the local shell selection from the tracked example exactly once. # env.lua is ignored by Git so each machine can keep its own choice. # --------------------------------------------------------------------------- ensure_shell_config() { local config_dir example_file config_file config_dir="$(repo_root)/hypr/.config/hypr" example_file="$config_dir/env.example.lua" config_file="$config_dir/env.lua" if [[ -e "$config_file" || -L "$config_file" ]]; then echo "==> Behalte lokale Shell-Auswahl: $config_file" return fi echo "==> Erstelle lokale Shell-Auswahl aus env.example.lua ..." cp "$example_file" "$config_file" } # --------------------------------------------------------------------------- # Keep Caelestia on upstream Quickshell. # # noctalia-qs can satisfy pacman's virtual quickshell-git dependency, but its # parser is not compatible with Caelestia. The explicit aur/quickshell-git # target bypasses that provider, then setup verifies that /usr/bin/qs really # belongs to quickshell-git. # --------------------------------------------------------------------------- warn_about_quickshell_provider() { if pacman -Q noctalia-qs >/dev/null 2>&1; then log "noctalia-qs ist installiert; die AUR-Transaktion ersetzt es durch quickshell-git." fi } verify_quickshell_runtime() { local owner if pacman -Q noctalia-qs >/dev/null 2>&1; then echo "Fehler: noctalia-qs ist weiterhin installiert; Caelestia benoetigt AUR quickshell-git." >&2 return 1 fi if ! pacman -Q quickshell-git >/dev/null 2>&1; then echo "Fehler: AUR-Paket quickshell-git wurde nicht installiert." >&2 return 1 fi owner="$(pacman -Qoq /usr/bin/qs 2>/dev/null || true)" if [[ "$owner" != "quickshell-git" ]]; then echo "Fehler: /usr/bin/qs gehoert zu '$owner' statt zu quickshell-git." >&2 return 1 fi log "Quickshell-Runtime geprueft: quickshell-git" } # --------------------------------------------------------------------------- # Post-install: run Hyprland environment & desktop integration scripts. # --------------------------------------------------------------------------- run_hypr_scripts() { local scripts_dir scripts_dir="$(repo_root)/hypr/.config/hypr/scripts" echo "==> Fuehre portal-host-override.sh aus ..." bash "$scripts_dir/portal-host-override.sh" echo "==> Fuehre fix_dolphin_file_associations.sh aus ..." bash "$scripts_dir/fix_dolphin_file_associations.sh" } # --------------------------------------------------------------------------- # Main # --------------------------------------------------------------------------- main() { local -a pacman_pkgs=() aur_pkgs=() npm_pkgs=() echo "==> Lese Paketliste: $PACKAGES_FILE" read_packages "$PACKAGES_FILE" pacman_pkgs aur_pkgs npm_pkgs warn_about_quickshell_provider install_all_pkgs pacman_pkgs aur_pkgs npm_pkgs verify_quickshell_runtime ensure_shell_config run_hypr_scripts echo "Fertig. Hyprland und das Compositor-Okosystem sind eingerichtet." } main