diff --git a/liquidprompt b/liquidprompt index bac8a7d..f85ae6a 100755 --- a/liquidprompt +++ b/liquidprompt @@ -200,7 +200,8 @@ _lp_source_config() LP_ENABLE_SVN=${LP_ENABLE_SVN:-1} LP_ENABLE_HG=${LP_ENABLE_HG:-1} LP_ENABLE_TIME=${LP_ENABLE_TIME:-0} - + LP_ENABLE_VIRTUALENV=${LP_ENABLE_VIRTUALENV:-1} + LP_MARK_BATTERY=${LP_MARK_BATTERY:-"⌁"} LP_MARK_ADAPTER=${LP_MARK_ADAPTER:-"⏚"} LP_MARK_LOAD=${LP_MARK_LOAD:-"⌂"} @@ -941,7 +942,11 @@ _lp_time() echo -ne "${LP_COLOR_TIME}$(date +%H:%M:%S)${NO_COL}" } - +_lp_virtualenv() +{ + [[ "$LP_ENABLE_VIRTUALENV" != 1 ]] && return + [[ -n "$VIRTUAL_ENV" ]] && echo "(`basename \"$VIRTUAL_ENV\"`)" +} ######################## # Construct the prompt # @@ -956,6 +961,7 @@ _lp_set_prompt() $LP_OLD_PROMPT_COMMAND # left of main prompt: space at right + LP_VENV=$(_lp_sr "$(_lp_virtualenv)") LP_JOBS=$(_lp_sr "$(_lp_jobcount_color)") LP_LOAD=$(_lp_sr "$(_lp_load_color)") LP_BATT=$(_lp_sr "$(_lp_battery_color)") @@ -989,7 +995,7 @@ _lp_set_prompt() if [[ -z $LP_PS1 ]] ; then # add time, jobs, load and battery - PS1="${LP_TIME}${LP_BATT}${LP_LOAD}${LP_JOBS}" + PS1="${LP_VENV}${LP_TIME}${LP_BATT}${LP_LOAD}${LP_JOBS}" # add user, host and permissions colon PS1="${PS1}[${LP_USER}${LP_HOST}${LP_PERM}"