From 40e2db6e71d2185abfc67236208d33d5ae94108c Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Aug 2012 14:28:18 +0200 Subject: [PATCH] use d/&/z instead of s/r/t for jobs markers Those are marks closer to the commands --- README.md | 7 ++++--- liquidprompt.bash | 15 +++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 155765a..45f694c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/liquidprompt.bash b/liquidprompt.bash index 1aeb6ce..1caa9b5 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -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" }