simpler punctuation and colorscheme

* less punctuation: replace brackets with a single letter around battery, load, nothing around jobs and return value
* avoid extra spaces
* uncolored punctuation
* color the prompt mark in red if root, else in bold white
* user in light white and working dir in bold white
This commit is contained in:
nojhan 2012-07-17 10:18:03 +02:00
commit 03e500fea2

View file

@ -121,11 +121,11 @@ __host_color()
if [ "$conn" == "lcl" ] ; then
ret="${ret}" # no hostname if local
elif [ "$conn" == "ssh" ] ; then
ret="${ret}@${CYAN}\h"
ret="${ret}@${LIGHT_CYAN}\h "
elif [ "$conn" == "tel" ] ; then
ret="${ret}@${WARN_RED}\h"
ret="${ret}@${WARN_RED}\h "
else
ret="${ret}@\h"
ret="${ret}@\h "
fi
echo -ne "${ret}${NO_COL}"
@ -144,13 +144,13 @@ __jobcount_color()
if [ $running != "0" -a $stopped != "0" ]
then
rep="${NO_COL}[${YELLOW}${running}r${NO_COL}/${LIGHT_YELLOW}${stopped}s${NO_COL}]"
rep="${NO_COL}${YELLOW}${running}r${NO_COL}/${LIGHT_YELLOW}${stopped}s${NO_COL} "
elif [ $running != "0" -a $stopped == "0" ]
then
rep="${NO_COL}[${YELLOW}${running}r${NO_COL}]"
rep="${NO_COL}${YELLOW}${running}r${NO_COL} "
elif [ $running == "0" -a $stopped != "0" ]
then
rep="${NO_COL}[${LIGHT_YELLOW}${stopped}s${NO_COL}]"
rep="${NO_COL}${LIGHT_YELLOW}${stopped}s${NO_COL} "
fi
echo -ne "$rep"
}
@ -189,16 +189,17 @@ __git_branch_color()
fi
if [ "$GD" -eq 1 -o "$GDC" -eq "1" ]; then
if [ "$has_commit" -gt "0" ] ; then
ret=" ${RED}${branch}${NO_COL}(${YELLOW}$has_commit${NO_COL})" # changes to commit and commits to push
# changes to commit and commits to push
ret=" ${RED}${branch}${NO_COL}(${YELLOW}$has_commit${NO_COL}) "
else
ret=" ${RED}${branch}${NO_COL}" # changes to commit
ret=" ${RED}${branch}${NO_COL} " # changes to commit
fi
else
if [ "$has_commit" -gt "0" ] ; then
# some commit(s) to push
ret=" ${YELLOW}${branch}${NO_COL}(${YELLOW}$has_commit${NO_COL})"
ret=" ${YELLOW}${branch}${NO_COL}(${YELLOW}$has_commit${NO_COL}) "
else
ret=" ${GREEN}${branch}${NO_COL}" # nothing to commit or push
ret=" ${GREEN}${branch}${NO_COL} " # nothing to commit or push
fi
fi
echo -ne "$ret"
@ -234,23 +235,23 @@ __battery_color()
if [ "$bat" != "" ] ; then
if [ ${bat} -gt 75 ]; then
return; # nothing displayed above 75%
return; # nothing displayed above 75%
fi
ret="${NO_COL}[battery="
ret="b${NO_COL}"
if [ ${bat} -le 75 ] && [ ${bat} -gt 50 ] ; then
ret="${ret}${LIGHT_GREEN}"
ret="${ret}${LIGHT_GREEN} "
elif [ ${bat} -le 40 ] && [ ${bat} -gt 20 ] ; then
ret="${ret}${LIGHT_YELLOW}"
ret="${ret}${LIGHT_YELLOW} "
elif [ ${bat} -le 20 ] && [ ${bat} -gt 10 ] ; then
ret="${ret}${LIGHT_RED}"
ret="${ret}${LIGHT_RED} "
elif [ ${bat} -le 10 ] && ${bat} -gt 5 ] ; then
ret="${ret}${WARN_RED}"
ret="${ret}${WARN_RED} "
else
ret="${ret}${CRIT_RED}"
ret="${ret}${CRIT_RED} "
fi
echo -ne "${ret}${bat}%${NO_COL}]"
echo -ne "${ret}${bat}%${NO_COL}"
fi
}
@ -285,21 +286,21 @@ __load_color()
if [ "$load" -ge "60" ]
then
ret="${NO_COL}["
ret="l${NO_COL}"
if [ $load -lt 70 ] ; then
ret="${ret}${LIGHT_GREY}"
ret="${ret}${LIGHT_GREY} "
elif [ $load -ge 1 ] && [ $load -lt 80 ] ; then
ret="${ret}${LIGHT_GREEN}"
ret="${ret}${LIGHT_GREEN} "
elif [ $load -ge 80 ] && [ $load -lt 95 ] ; then
ret="${ret}${LIGHT_YELLOW}"
ret="${ret}${LIGHT_YELLOW} "
elif [ $load -ge 95 ] && [ $load -lt 150 ] ; then
ret="${ret}${LIGHT_RED}"
ret="${ret}${LIGHT_RED} "
elif [ $load -ge 150 ] && [ $load -lt 200 ] ; then
ret="${ret}${WARN_RED}"
ret="${ret}${WARN_RED} "
else
ret="${ret}${CRIT_RED}"
ret="${ret}${CRIT_RED} "
fi
ret="${ret}cpu=$load%${NO_COL}]"
ret="${ret}$load%${NO_COL} "
echo -ne "${ret}"
fi
}
@ -312,12 +313,12 @@ __smart_mark()
git log -1 >/dev/null 2>&1
if [ "$?" -eq "0" ]
then
echo -n '±'
echo -ne "${WHITE}±${NO_COL}"
else
echo -n '$'
echo -ne "${WHITE}\\\$${NO_COL}"
fi
else
echo -n '#'
echo -ne "${RED}#${NO_COL}"
fi
}
@ -325,7 +326,7 @@ __return_value()
{
if [ "$1" -ne "0" ]
then
echo -ne "${NO_COL}[${PURPLE}\\\$?=$1${NO_COL}]"
echo -ne "${NO_COL}${PURPLE}$1${NO_COL} "
fi
}
@ -341,10 +342,10 @@ __set_bash_prompt()
PS1="${__BATT}${__LOAD}${__JOBS}"
if [ "$EUID" -ne "0" ]
then
PS1="${PS1}${LIGHT_GREEN}\u${__HOST}${NO_COL}:${LIGHT_BLUE}\w${NO_COL}"
PS1="${PS1}[${LIGHT_GREY}\u${NO_COL}${__HOST}:${WHITE}\w${NO_COL}]"
PS1="${PS1}${__GIT}"
else
PS1="${PS1}${LIGHT_RED}\u${__HOST}${NO_COL}:${LIGHT_BLUE}\w${NO_COL}"
PS1="${PS1}${LIGHT_YELLOW}\u${__HOST}${NO_COL}:${YELLOW}\w${NO_COL}"
fi
PS1="${PS1}${__RETURN}${__PROMPT} "