diff --git a/.config/zsh/p10k-server.zsh b/.config/zsh/p10k-server.zsh new file mode 100644 index 0000000..9221d94 --- /dev/null +++ b/.config/zsh/p10k-server.zsh @@ -0,0 +1,45 @@ +# powerlevel10k configuration for the server role. +# +# Deliberately not the wizard's output. A server is reached from whatever +# terminal happens to be at hand, so this uses ASCII rather than the icon set +# that assumes a Nerd Font, and keeps the segment list short enough to read at +# a glance during an incident. +# +# Sourced from 50-server.zsh, which runs after oh-my-zsh has loaded +# powerlevel10k - the same point in the sequence at which p10k expects its own +# ~/.p10k.zsh. beastix keeps its own file and is untouched by this. + +# No glyphs. The prompt has to be legible from a phone terminal too. +typeset -g POWERLEVEL9K_MODE=ascii +typeset -g POWERLEVEL9K_ICON_PADDING=none + +# One line, no frame. Nothing decorative survives being read in a hurry. +typeset -g POWERLEVEL9K_PROMPT_ON_NEWLINE=false +typeset -g POWERLEVEL9K_RPROMPT_ON_NEWLINE=false +typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs prompt_char) +typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time time) + +# The point of the whole exercise: user@host, always, in red. shron carries +# mail, web and cloud, and the prompt should answer "which machine is this" +# before the next command is typed. +typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true +typeset -g POWERLEVEL9K_ALWAYS_SHOW_USER=true +typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' +typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=red +typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=white +typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND=red +typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=white +typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=red +typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=yellow + +typeset -g POWERLEVEL9K_DIR_BACKGROUND=blue +typeset -g POWERLEVEL9K_DIR_FOREGROUND=white +typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique + +# Only mention how long something took when it was long enough to notice. +typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 +typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M}' + +# Instant prompt would need a cache file this machine has no reason to carry. +typeset -g POWERLEVEL9K_INSTANT_PROMPT=off +typeset -g POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true diff --git a/.config/zsh/rc.d/50-server.zsh b/.config/zsh/rc.d/50-server.zsh index 4ff92b9..2dc67f7 100644 --- a/.config/zsh/rc.d/50-server.zsh +++ b/.config/zsh/rc.d/50-server.zsh @@ -3,15 +3,14 @@ # The theme and DISABLE_AUTO_UPDATE are in 05-pre-omz.zsh, because oh-my-zsh # reads them while it is being sourced. -# Role colour, set here rather than earlier because ~/.p10k.zsh assigns -# POWERLEVEL9K_CONTEXT_BACKGROUND itself and is sourced in 30-path.zsh. +# The prompt, in a file of its own because there is more to it than a colour. +# Sourced here rather than earlier: this is the point at which oh-my-zsh has +# loaded powerlevel10k, which is where p10k expects its configuration. # -# Note that this only takes effect where powerlevel10k is installed, and on -# shron it is not - the ys theme has no equivalent. The colour is kept anyway -# so it works the moment p10k arrives, but the red prompt cannot be relied on -# as a safeguard there today. -typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=red -typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true +# beastix keeps its own ~/.p10k.zsh, sourced from 30-path.zsh. This one is +# separate because a server is reached from whatever terminal is at hand and +# cannot assume the desktop's Nerd Font. +[[ -r "$HOME/.config/zsh/p10k-server.zsh" ]] && source "$HOME/.config/zsh/p10k-server.zsh" # German locale. The base does not set one, since the desktop inherits it from # the session and the Mac has its own; an SSH session brings only what the