From 889de1befd08cd11bb8d8dd1eb43fa0ac3e2c8d5 Mon Sep 17 00:00:00 2001 From: Jose Lago Date: Sat, 16 May 2026 20:44:59 +0200 Subject: [PATCH] fix --- post-install-cachyos.sh | 70 +++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/post-install-cachyos.sh b/post-install-cachyos.sh index 64d63d9..a1ee7ae 100755 --- a/post-install-cachyos.sh +++ b/post-install-cachyos.sh @@ -645,55 +645,58 @@ configure_zsh_ohmyzsh_powerlevel10k() { log "Oh My Zsh is already installed." fi - zsh_custom="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}" + zsh_custom="$HOME/.oh-my-zsh/custom" p10k_dir="$zsh_custom/themes/powerlevel10k" + mkdir -p "$zsh_custom/themes" + if [[ -d "$p10k_dir/.git" ]]; then log "Powerlevel10k already exists. Updating..." git -C "$p10k_dir" pull --ff-only || warn "Could not update Powerlevel10k. Continuing with existing copy." else - log "Installing Powerlevel10k..." + log "Installing Powerlevel10k into $p10k_dir..." + rm -rf "$p10k_dir" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$p10k_dir" fi - if [[ -f "$HOME/.zshrc" ]] && ! grep -q "powerlevel10k/powerlevel10k" "$HOME/.zshrc"; then - cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d%H%M%S)" + if [[ ! -f "$p10k_dir/powerlevel10k.zsh-theme" ]]; then + warn "Powerlevel10k theme file was not found after installation: $p10k_dir/powerlevel10k.zsh-theme" + return fi if [[ -f "$HOME/.zshrc" ]]; then - tmp_zshrc="$(mktemp)" - grep -v "POWERLEVEL9K_INSTANT_PROMPT" "$HOME/.zshrc" > "$tmp_zshrc" || true - { - echo "typeset -g POWERLEVEL9K_INSTANT_PROMPT=off" - cat "$tmp_zshrc" - } > "$HOME/.zshrc" - rm -f "$tmp_zshrc" + cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d%H%M%S)" fi - if [[ ! -f "$HOME/.zshrc" ]]; then - cat > "$HOME/.zshrc" < "$HOME/.zshrc" <<'ZSHRC' +# Disable Powerlevel10k instant prompt because this setup intentionally prints +# Fastfetch system information at terminal startup. +typeset -g POWERLEVEL9K_INSTANT_PROMPT=off +export ZSH="$HOME/.oh-my-zsh" +ZSH_CUSTOM="$ZSH/custom" +ZSH_THEME="powerlevel10k/powerlevel10k" + +plugins=( + git + sudo +) + +source "$ZSH/oh-my-zsh.sh" + +# Jose fastfetch terminal summary +# Disable with: export DISABLE_FASTFETCH=1 +if [[ -o interactive ]] && [[ -z "${DISABLE_FASTFETCH:-}" ]] && [[ -z "${FASTFETCH_SHOWN:-}" ]] && command -v fastfetch >/dev/null 2>&1; then + export FASTFETCH_SHOWN=1 + fastfetch + echo +fi + +# Powerlevel10k user config. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh ZSHRC - else - if grep -q "^ZSH_THEME=" "$HOME/.zshrc"; then - sed -i "s|^ZSH_THEME=.*|ZSH_THEME=\"powerlevel10k/powerlevel10k\"|" "$HOME/.zshrc" - else - printf "\nZSH_THEME=\"powerlevel10k/powerlevel10k\"\n" >> "$HOME/.zshrc" - fi - - if ! grep -q "oh-my-zsh.sh" "$HOME/.zshrc"; then - printf "\nexport ZSH=\"\$HOME/.oh-my-zsh\"\nsource \"\$ZSH/oh-my-zsh.sh\"\n" >> "$HOME/.zshrc" - fi - - if ! grep -q ".p10k.zsh" "$HOME/.zshrc"; then - printf "\n[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh\n" >> "$HOME/.zshrc" - fi - fi current_shell="$(getent passwd "$USER" | cut -d: -f7 || true)" zsh_path="$(command -v zsh)" @@ -706,10 +709,9 @@ ZSHRC fi log "Zsh + Oh My Zsh + Powerlevel10k configured." - warn "Open Ghostty after reboot/login. Powerlevel10k will start its configuration wizard the first time." + warn "Open Ghostty after reboot/login. Run 'p10k configure' if you want to customize the prompt." } - configure_wireguard_gui_webkit_workaround() { log "Configuring WireGuard GUI WebKit renderer workaround..."