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.
This commit is contained in:
vh
2026-06-26 07:59:20 -07:00
parent bf179ef0b1
commit 20d0b98df6
+10 -4
View File
@@ -105,12 +105,18 @@
# Blue current directory. # Blue current directory.
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$lightergrey 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" 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" typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
# Don't show context unless root or in SSH. typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_TEMPLATE="%F{$grey}%m%f"
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= 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. # Show previous command duration only if it's >= 5s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5