diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-01-02 09:51:53 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-01-02 09:51:53 +0300 |
commit | dd3dcfaf51d2f12ea208c0c96b2f039c0435ec00 (patch) | |
tree | 179a07f4c332673111dd3d56ac9a9d789cb27b2d /internal/p10k.zsh | |
parent | ced77880120dc8073f5781fc7994942ff5ebbfae (diff) |
make `toolbox` segment work with distrobox (#1696)
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 275cf023..20417687 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -8227,14 +8227,17 @@ _p9k_init_ssh() { } _p9k_init_toolbox() { - [[ -z $P9K_TOOLBOX_NAME && - -e /run/.toolboxenv && - -f /run/.containerenv && - -r /run/.containerenv ]] || return 0 - local name=(${(Q)${${(@M)${(f)"$(</run/.containerenv)"}:#name=*}#name=}}) - (( ${#name} == 1 )) || return 0 - [[ -n ${name[1]} ]] || return 0 - typeset -g P9K_TOOLBOX_NAME=${name[1]} + [[ -z $P9K_TOOLBOX_NAME ]] || return 0 + if [[ -f /run/.containerenv && -r /run/.containerenv ]]; then + local name=(${(Q)${${(@M)${(f)"$(</run/.containerenv)"}:#name=*}#name=}}) + [[ ${#name} -eq 1 && -n ${name[1]} ]] || return 0 + typeset -g P9K_TOOLBOX_NAME=${name[1]} + elif [[ -n $DISTROBOX_ENTER_PATH && -n $NAME ]]; then + local name=${(%):-%m} + if [[ $name == $NAME* ]]; then + typeset -g P9K_TOOLBOX_NAME=$name + fi + fi } _p9k_must_init() { |