use d/&/z instead of s/r/t for jobs markers

Those are marks closer to the commands
This commit is contained in:
nojhan 2012-08-10 14:28:18 +02:00
parent a9d151f9ed
commit 40e2db6e71
2 changed files with 13 additions and 9 deletions

View File

@ -24,7 +24,7 @@ in a git repository on a server, at branch "myb":
A liquid prompt displaying everything may look like this:
`⌁24% ⌂42% 1s/1r/1t [user@server:~/ … /code/liquidprompt]↥ g·master(+10/-5,3) 125 ± `
`⌁24% ⌂42% 3d/2&/1z [user@server:~/ … /code/liquidprompt]↥ g·master(+10/-5,3) 125 ± `
It displays:
@ -32,7 +32,7 @@ It displays:
threshold, with a colormap too;
* the average of the processors load, if it is over a given limit, with a
colormap that became more and more noticeable with increasing load;
* the number of detached `screen` sessions, if there is any;
* the number of detached sessions (`screen`), if there is any;
* the number of attached sleeping jobs (when you interrupt a command with Ctrl-Z
and bring it back with `fg`), if there is any;
* the number of attached running jobs (commands started with a `&`), if there is
@ -88,11 +88,12 @@ it only when connected with a remote shell
Most of the display is prepared in the `__set_bash_prompt` function, apart from
features that needs several colors (such as the load colormap). You can sort
what you want to see by editing the PS1 variable here.
what you want to see by editing the `PS1` variable here.
## KNOWN LIMITATIONS AND BUGS
* detached sessions only looks for `screen`, a `tmux` support would be nice…
* Does not display the number of commits to be pushed in Mercurial repositories.
* Subversion repository cannot display commits to be pushed, this is a
limitation of the Subversion versionning model.

View File

@ -416,24 +416,27 @@ __jobcount_color()
local running=$(jobs -r | wc -l | tr -d " ")
local stopped=$(jobs -s | wc -l | tr -d " ")
local screens=$(screen -ls 2> /dev/null | grep -c Detach )
local m_detached="d"
local m_stop="z"
local m_run="&"
if [[ $running != "0" && $stopped != "0" && $screens != "0" ]] ; then
rep="${NO_COL}${YELLOW}${screens}s${NO_COL}/${YELLOW}${running}r${NO_COL}/${BOLD_YELLOW}${stopped}t${NO_COL}"
rep="${NO_COL}${YELLOW}${screens}${m_detached}${NO_COL}/${YELLOW}${running}${m_run}${NO_COL}/${BOLD_YELLOW}${stopped}${m_stop}${NO_COL}"
elif [[ $running != "0" && $stopped == "0" && $screens == "0" ]] ; then
rep="${NO_COL}${YELLOW}${running}r${NO_COL}"
rep="${NO_COL}${YELLOW}${running}${m_run}${NO_COL}"
elif [[ $running == "0" && $stopped != "0" && $screens == "0" ]] ; then
rep="${NO_COL}${BOLD_YELLOW}${stopped}t${NO_COL}"
rep="${NO_COL}${BOLD_YELLOW}${stopped}${m_stop}${NO_COL}"
elif [[ $running == "0" && $stopped == "0" && $screens != "0" ]] ; then
rep="${NO_COL}${YELLOW}${screens}s${NO_COL}"
rep="${NO_COL}${YELLOW}${screens}${m_detached}${NO_COL}"
elif [[ $running != "0" && $stopped == "0" && $screens != "0" ]] ; then
rep="${NO_COL}${YELLOW}${screens}s${NO_COL}/${YELLOW}${running}r${NO_COL}"
rep="${NO_COL}${YELLOW}${screens}${m_detached}${NO_COL}/${YELLOW}${running}${m_run}${NO_COL}"
elif [[ $running == "0" && $stopped != "0" && $screens != "0" ]] ; then
rep="${NO_COL}${YELLOW}${screens}s${NO_COL}/${BOLD_YELLOW}${stopped}t${NO_COL}"
rep="${NO_COL}${YELLOW}${screens}${m_detached}${NO_COL}/${BOLD_YELLOW}${stopped}${m_stop}${NO_COL}"
fi
echo -ne "$rep"
}