Files
dotconfs/.config/zsh/rc.d/05-pre-omz.zsh
T
thomas.koppandClaude Opus 5 0bfef0662a fix: fall back to ys on any machine without powerlevel10k
The fallback was written for the server role only, so the Mac - which also runs
ys and also has no p10k - dropped through to oh-my-zsh's default theme instead.
A silent downgrade of the prompt on a machine that was working fine.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 22:29:32 +02:00

55 lines
2.1 KiB
Bash

# Everything that has to be set before oh-my-zsh is sourced, and nothing else.
#
# oh-my-zsh reads the theme and its own settings while being sourced, so any of
# these placed in a role file - which comes afterwards - is silently ignored.
# The first attempt put ZSH_THEME in the role file and produced a shell that
# reported the right value while running without powerlevel10k at all.
#
# The role COLOUR is deliberately NOT here. ~/.p10k.zsh assigns
# POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced later from
# 30-path.zsh, so a colour set here is overwritten before the first prompt is
# drawn. It belongs in the role files, which run after that.
if [[ -d "${ZSH_CUSTOM:-$ZSH/custom}/themes/powerlevel10k" ]]; then
ZSH_THEME="powerlevel10k/powerlevel10k"
else
# ys is what both machines without powerlevel10k already ran. Without this
# they fall through to oh-my-zsh's default, which is a change nobody asked
# for - the Mac did exactly that on the first attempt, where this fallback
# was written for the server role only.
ZSH_THEME="ys"
fi
case "$ROLE" in
server)
# A server should not decide on its own to go fetching updates while
# someone is logged in trying to fix something.
DISABLE_AUTO_UPDATE="true"
;;
*)
zstyle ':omz:update' mode auto
;;
esac
# Plugins. Assembled here rather than in the stub because the set is
# role-dependent: macos, brew and dotbare exist only on the Mac, archlinux only
# where pacman does. A single shared list would have silently dropped four
# plugins on the Mac.
#
# Filtered by what is actually present. Naming a plugin that is not installed
# makes oh-my-zsh complain on every shell start, and the local custom plugin
# signal-keyring is exactly that case on any machine other than beastix.
_want=(git colored-man-pages colorize zsh-interactive-cd fzf)
case "$ROLE" in
desktop|server) _want+=(archlinux) ;;
mobile) _want+=(macos brew dotbare) ;;
esac
plugins=()
for _p in $_want; do
if [[ -d "$ZSH/plugins/$_p" || -d "${ZSH_CUSTOM:-$ZSH/custom}/plugins/$_p" ]]; then
plugins+=("$_p")
fi
done
unset _p _want