feat(zsh): ys-style gruvbox prompt on servers instead of p10k

Thomas prefers the two-line ys layout root already had. user@host in
gruvbox red (a red block for root) marks the machine. Shared file so
root's shell can use a root-owned copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thomas.koppandClaude Opus 5.5 committed 2026-10-19 00:59:24 +02:00
1 parent 7edb68aaba
commit 4ca0a7ce8b
4 files changed
+39 -61

No files matched your search

-52
View File
@@ -1,52 +0,0 @@
# 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'
#
# Fixed 256-colour indices, not the named ANSI colours. Terminal themes remap
# the first 16 freely - under gruvbox "white" is a mid grey and "blue" a muted
# teal, which left the text barely legible. 231 is pure white; 124 and 24 are
# dark enough to give it roughly 7:1 contrast on either segment.
typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=124
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=231
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND=124
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=231
typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=124
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=226
typeset -g POWERLEVEL9K_DIR_BACKGROUND=24
typeset -g POWERLEVEL9K_DIR_FOREGROUND=231
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=252
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=231
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
+5 -1
View File
@@ -10,7 +10,11 @@
# 30-path.zsh, so a colour set here is overwritten before the first prompt is # 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. # drawn. It belongs in the role files, which run after that.
if [[ -d "${ZSH_CUSTOM:-$ZSH/custom}/themes/powerlevel10k" ]]; then if [[ "$ROLE" == server ]]; then
# The server draws its own ys-style prompt in 50-server.zsh. A theme loaded
# here would overwrite it before every prompt (p10k does so from precmd).
ZSH_THEME=""
elif [[ -d "${ZSH_CUSTOM:-$ZSH/custom}/themes/powerlevel10k" ]]; then
ZSH_THEME="powerlevel10k/powerlevel10k" ZSH_THEME="powerlevel10k/powerlevel10k"
else else
# ys is what both machines without powerlevel10k already ran. Without this # ys is what both machines without powerlevel10k already ran. Without this
+3 -8
View File
@@ -3,14 +3,9 @@
# The theme and DISABLE_AUTO_UPDATE are in 05-pre-omz.zsh, because oh-my-zsh # The theme and DISABLE_AUTO_UPDATE are in 05-pre-omz.zsh, because oh-my-zsh
# reads them while it is being sourced. # reads them while it is being sourced.
# The prompt, in a file of its own because there is more to it than a colour. # The prompt: ys layout in gruvbox colours, in a file of its own because
# Sourced here rather than earlier: this is the point at which oh-my-zsh has # root's shell uses the same one (installed root-owned, see the file).
# loaded powerlevel10k, which is where p10k expects its configuration. [[ -r "$HOME/.config/zsh/server-prompt.zsh" ]] && source "$HOME/.config/zsh/server-prompt.zsh"
#
# 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 # 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 # the session and the Mac has its own; an SSH session brings only what the
+31
View File
@@ -0,0 +1,31 @@
# Prompt for the server role: oh-my-zsh's ys layout in gruvbox colours.
#
# Replaces powerlevel10k on shron. Two lines, plain ASCII, readable from any
# terminal. Fixed 256-colour indices approximating gruvbox, because terminal
# themes remap the 16 named colours freely - under gruvbox "white" on "blue"
# was barely legible.
#
# user@host is what has to stand out: plain red for templis, a red block for
# root. The same file is installed root-owned for root's shell (never sourced
# from this home directory, which would let templis run code as root).
#
# Needs oh-my-zsh loaded first (git_prompt_info) and no other theme active.
# gruvbox (256-colour): red 167, yellow 214, green 142, aqua 108, blue 109,
# grey 245, dark background 235
ZSH_THEME_GIT_PROMPT_PREFIX=" %F{245}on%f git:%F{108}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
ZSH_THEME_GIT_PROMPT_DIRTY=" %F{167}x"
ZSH_THEME_GIT_PROMPT_CLEAN=" %F{142}o"
setopt PROMPT_SUBST
PROMPT='
%B%(#,%F{167},%F{109})#%f%b \
%(#,%K{167}%F{235}%B %n@%m %b%f%k,%B%F{167}%n@%m%f%b) \
%F{245}in%f \
%B%F{214}%~%f%b\
$(git_prompt_info) \
%F{245}[%*]%f%(?,, C:%F{167}%?%f)
%B%F{167}%#%f%b '
RPROMPT=''