Skip to content

Commit

Permalink
Show hostname when inside containers too
Browse files Browse the repository at this point in the history
`distrobox` (and other toolbox-like containers) set a hostname,
and it is useful to be able to distinguish whether you are inside the
container or outside.
When /run/.containerenv is present then show the hostname, just as if it
was an SSH-ed remote host.

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jan 1, 2023
1 parent 87ea6db commit bf13d44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion agkozak-zsh-prompt.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ prompt_agkozak-zsh-prompt_setup() {
fi

# Only display the HOSTNAME for an SSH connection or for a superuser
if _agkozak_is_ssh || (( EUID == 0 )); then
if _agkozak_is_ssh || (( EUID == 0 )) || test -f /run/.containerenv; then
psvar[1]="@${(%):-%m}"
else
psvar[1]=''
Expand Down

0 comments on commit bf13d44

Please sign in to comment.