Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/omb-prompt-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ CHRUBY_THEME_PROMPT_SUFFIX='|'
# OMB_PROMPT_PYTHON_VERSION_FORMAT=' |%s|'
# OMB_PROMPT_SHOW_PYTHON_VENV=true
OMB_PROMPT_SPACK_ENV_FORMAT='[%s] '
OMB_PROMPT_DISTROBOX_FORMAT='[📦%s] '

# deprecate
VIRTUALENV_THEME_PROMPT_PREFIX=' |'
Expand Down Expand Up @@ -397,6 +398,17 @@ function hg_prompt_vars {
fi
}

## @fn _omb_prompt_get_distrobox_container
## @var[out] distrobox_container
## @exit
function _omb_prompt_get_distrobox_container {
distrobox_container=
[[ ${CONTAINER_ID-} ]] || return 1
distrobox_container=${CONTAINER_ID}
_omb_prompt_format distrobox_container "$distrobox_container" OMB_PROMPT_DISTROBOX:DISTROBOX_THEME_PROMPT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_omb_prompt_format distrobox_container "$distrobox_container" OMB_PROMPT_DISTROBOX:DISTROBOX_THEME_PROMPT
_omb_prompt_format distrobox_container "$distrobox_container" OMB_PROMPT_DISTROBOX

The name after : is used to process a deprecated form of the format specifier <name>_PREFIX and <name>_SUFFIX. However, this prompt information is a new one and there hasn't been deprecated variables DISTROBOX_THEME_PROMPT_PREFIX and DISTROBOX_THEME_PROMPT_SUFFIX. We don't want to add new deprecated variables that have never been used.

[[ $distrobox_container ]]
}

## @fn _omb_prompt_get_rbfu
## @var[out] rbfu
## @exit
Expand Down
4 changes: 3 additions & 1 deletion themes/font/font.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ function _omb_theme_PROMPT_COMMAND() {
python_venv=$_omb_prompt_white$python_venv
local spack_env; _omb_prompt_get_spack_env
spack_env=$_omb_prompt_white$spack_env
local distrobox_container; _omb_prompt_get_distrobox_container
distrobox_container=$_omb_prompt_yellow$distrobox_container

# Set return status color
if [[ ${RC} == 0 ]]; then
Expand All @@ -57,7 +59,7 @@ function _omb_theme_PROMPT_COMMAND() {
# Append new history lines to history file
history -a

PS1="$(clock_prompt)$spack_env$python_venv${hostname} ${_omb_prompt_bold_teal}\W $(scm_prompt_char_info)${ret_status}→ ${_omb_prompt_normal}"
PS1="$(clock_prompt)$distrobox_container$spack_env$python_venv${hostname} ${_omb_prompt_bold_teal}\W $(scm_prompt_char_info)${ret_status}→ ${_omb_prompt_normal}"
}

_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND