From 9c9693f62429ba56d6e37a2eff39f72ccbaa7fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Sun, 25 Dec 2022 23:24:50 +0000 Subject: [PATCH] Show hostname when inside containers too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 --- agkozak-zsh-prompt.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agkozak-zsh-prompt.plugin.zsh b/agkozak-zsh-prompt.plugin.zsh index 5ceb6b2..22f53f7 100644 --- a/agkozak-zsh-prompt.plugin.zsh +++ b/agkozak-zsh-prompt.plugin.zsh @@ -1033,7 +1033,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]=''