diff --git a/liquidprompt.bash b/liquidprompt.bash index 353902f..731c6fc 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -49,26 +49,13 @@ unset bash bmajor bminor # CONFIGURATION # ################# -# Maximal value under which the battery level is displayed -# Recommended value is 75 -BATTERY_THRESHOLD=75 +LP_BATTERY_THRESHOLD=75 +LP_LOAD_THRESHOLD=60 +LP_PATH_LENGTH=35 +LP_PATH_KEEP=2 +LP_REVERSE=0 -# Minimal value after which the load average is displayed -# Recommended value is 60 -LOAD_THRESHOLD=60 - -# The maximum percentage of the screen width used to display the path -# Recommended value is 35 -PATH_LENGTH=35 - -# How many directories to keep at the beginning of a shortened path -# Recommended value is 2 -PATH_KEEP=2 - -# Do we use reverse colors (black on white) instead of normal theme (white on black) -# Defaults to 0 (normal colors) -# set to 1 if you use black on white -REVERSE=0 +source ~/.liquidpromptrc 2> /dev/null ############### @@ -150,7 +137,7 @@ fi # can be set to white or black FG=$WHITE BOLD_FG=$BOLD_WHITE -if [[ $REVERSE == 1 ]] ; then +if [[ $LP_REVERSE == 1 ]] ; then FG=$BLACK BOLD_FG=$BOLD_GRAY fi @@ -300,7 +287,7 @@ __shorten_path() # the character that will replace the part of the path that is masked local mask=" … " # index of the directory to keep from the root (starts at 0) - local keep=$((PATH_KEEP-1)) + local keep=$((LP_PATH_KEEP-1)) local len_percent=$2 @@ -556,7 +543,7 @@ __battery() if [[ "${bat}" == "" ]] ; then return 1 fi - if [[ ${bat} -le $BATTERY_THRESHOLD ]] ; then + if [[ ${bat} -le $LP_BATTERY_THRESHOLD ]] ; then echo -n "${bat}" return 0 else @@ -571,7 +558,7 @@ __battery_color() if [[ "$?" = "1" ]] ; then return; fi; # no battery support if [[ "$bat" != "" ]] ; then - if [[ ${bat} -gt $BATTERY_THRESHOLD ]] ; then + if [[ ${bat} -gt $LP_BATTERY_THRESHOLD ]] ; then return; # nothing displayed above 75% fi @@ -614,7 +601,7 @@ __load_color() fi let "load=$load/$__CPUNUM" - if [[ $load -ge $LOAD_THRESHOLD ]] + if [[ $load -ge $LP_LOAD_THRESHOLD ]] then ret="l${NO_COL}" if [[ $load -lt 70 ]] ; then @@ -702,7 +689,7 @@ __set_bash_prompt() __USER=$(__user) __HOST=$(__host_color) __PERM=$(__permissions_color) - __PWD=$(__shorten_path $PWD $PATH_LENGTH) + __PWD=$(__shorten_path $PWD $LP_PATH_LENGTH) # right of main prompt: space at left __GIT=$(__sl "$(__git_branch_color)") diff --git a/liquidpromptrc-dist b/liquidpromptrc-dist new file mode 100644 index 0000000..08d4f14 --- /dev/null +++ b/liquidpromptrc-dist @@ -0,0 +1,26 @@ + +#################################### +# LIQUID PROMPT CONFIGURATION FILE # +#################################### + +# Maximal value under which the battery level is displayed +# Recommended value is 75 +LP_BATTERY_THRESHOLD=75 + +# Minimal value after which the load average is displayed +# Recommended value is 60 +LP_LOAD_THRESHOLD=60 + +# The maximum percentage of the screen width used to display the path +# Recommended value is 35 +LP_PATH_LENGTH=35 + +# How many directories to keep at the beginning of a shortened path +# Recommended value is 2 +LP_PATH_KEEP=2 + +# Do we use reverse colors (black on white) instead of normal theme (white on black) +# Defaults to 0 (normal colors) +# set to 1 if you use black on white +LP_REVERSE=0 +