From 20d0b98df62e70b26105eda022f8a2f99cd98978 Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Fri, 26 Jun 2026 07:59:20 -0700 Subject: [PATCH] feat(p10k): show hostname by the clock, tag native vs ssh Context segment already sat left of the time segment but was hidden in the local (DEFAULT) state. Show the hostname there: grey when native, yellow with an explicit ' ssh' tag when remote (p10k's REMOTE state detects SSH for free). Only the local-sudo state stays quiet. --- home_root/.p10k.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/home_root/.p10k.zsh b/home_root/.p10k.zsh index df1c9db..a289c59 100644 --- a/home_root/.p10k.zsh +++ b/home_root/.p10k.zsh @@ -105,12 +105,18 @@ # Blue current directory. typeset -g POWERLEVEL9K_DIR_FOREGROUND=$lightergrey - # Context format when root: user@host. The first part white, the rest grey. + # Context sits just left of the clock and shows the hostname, with the + # session type made obvious at a glance: + # native (local) -> grey hostname + # ssh (remote) -> yellow hostname tagged " ssh" + # root -> user@host, username in white typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f" - # Context format when not root: user@host. The whole thing grey. typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f" - # Don't show context unless root or in SSH. - typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= + typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_TEMPLATE="%F{$grey}%m%f" + typeset -g POWERLEVEL9K_CONTEXT_REMOTE_TEMPLATE="%F{$yellow}%m%f%F{$grey} ssh%f" + typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_TEMPLATE="%F{$white}%n%f%F{$yellow}@%m%f%F{$grey} ssh%f" + # Keep only the local-sudo state quiet (matches Pure); every other state shows. + typeset -g POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION= # Show previous command duration only if it's >= 5s. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5