Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: get the number of active jobs to show in the prompt?



On Wed, Oct 03, 2001 at 16:22:46 +0200, Vincent Lefevre wrote:
> This doesn't solve my problem: for instance, after a Ctrl-L, the
> message disappears. I think that the best thing I can do is to put
> the jobs status directly to the terminal title, and this can be
> done with TRAPCLD.

I now have the following:

precmd()
{
  psvar[1]=$#jobstates;
  if [[ $psvar[1] -eq 0 ]] then
    psvar[1]=()
  elif [[ $psvar[1] -eq 1 ]] then
    psvar[1]="$psvar[1] job"
  else
    psvar[1]="$psvar[1] jobs"
  fi
  # Note: STY is set by screen
  if [[ $TERM == (xterm*|dtterm|rxvt) && -z $STY ]] then
    print -nP "\e]1;%m:%.\x07"
    print -nP "\e]2;%(1v. [%1v] .)${WINTITLE:+ [$WINTITLE]} %n@%m - %~ \x07"
  fi
}

TRAPCLD() { precmd }

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Messages sorted by: Reverse Date, Date, Thread, Author