powerlevel10k
powerlevel10k copied to clipboard
`toolbox` segment not showing after entering a `distrobox` container
I've been playing with distrobox containers, and noticed that you have added a toolbox
segment which also supports distrobox
. PR for distrobox support here https://github.com/romkatv/powerlevel10k/issues/1696.
I found the relevant detection code here internal/p10k.zsh. Specifically the elif
block:
elif [[ -n $DISTROBOX_ENTER_PATH && -n $NAME ]]; then
local name=${(%):-%m}
if [[ $name == $NAME* ]]; then
typeset -g P9K_TOOLBOX_NAME=$name
fi
fi
I found the $NAME
env var is empty, so the block is skipped. Updating this to $HOST
works (ZSH builtin env var). the updated code looks like this:
elif [[ -n $DISTROBOX_ENTER_PATH && -n $HOST ]]; then
local name=${(%):-%m}
if [[ $name == $NAME* ]]; then
typeset -g P9K_TOOLBOX_NAME=$name
fi
fi
I'm using Fedora 36 as the host OS and Ubuntu 22.04 as the distrobox container (also tested archlinux container with the same result).
What are your thoughts on my update above? PR here: #1916
Fixed via https://github.com/romkatv/powerlevel10k/pull/1916