LP_PS1_PREFIX used to add arbitrary prompt before anything else

This commit is contained in:
Christophe Drevet 2013-01-04 13:01:06 +01:00
parent 1bf7fd93a5
commit db313ba89e
2 changed files with 9 additions and 1 deletions

View File

@ -129,6 +129,13 @@ Note also that all the `LP_ENABLE_…` variables override the templates,
i.e. if you use `$LP_BATT` in your template and you set `LP_ENABLE_BATT=0`
in your config file, you will not have the battery informations.
## ADD A PS1 PREFIX
You can prefix the `LP_PS1` variable with anything you want using the
`LP_PS1_PREFIX`. The following example activate title change on xterm-like
windows:
export LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]"
## PUT THE PROMPT IN A DIFFERENT ORDER

View File

@ -189,6 +189,7 @@ _lp_source_config()
LP_PATH_KEEP=${LP_PATH_KEEP:-2}
LP_HOSTNAME_ALWAYS=${LP_HOSTNAME_ALWAYS:-0}
LP_PS1=${LP_PS1:-""}
LP_PS1_PREFIX=${LP_PS1_PREFIX:-""}
LP_ENABLE_PERM=${LP_ENABLE_PERM:-1}
LP_ENABLE_SHORTEN_PATH=${LP_ENABLE_SHORTEN_PATH:-1}
@ -1016,7 +1017,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_PS1_PREFIX}${LP_TIME}${LP_BATT}${LP_LOAD}${LP_JOBS}"
# add user, host and permissions colon
PS1="${PS1}[${LP_USER}${LP_HOST}${LP_PERM}"