zsh-users
 help / color / mirror / code / Atom feed
From: Alain Caron <alainc@sangacorp.com>
To: pumilia@est.it
Cc: zsh-users@math.gatech.edu
Subject: Re: A job signaller
Date: Thu, 29 Oct 1998 14:16:42 +0000	[thread overview]
Message-ID: <363878CA.27586B27@sangacorp.com> (raw)
In-Reply-To: <19981029143654.A4064@wigner.cstc.org>

Paolo Pumilia wrote:
> 
> Hi z-shell users,
> Is there a way to put a mark within the prompt string to
> inform the user that jobs are still running from that shell?
> (e.g +/-: "+" for running or stopped jobs; "-" for no jobs)
> 
> thank you for your suggestions
> 
> Paolo Pumilia
> 
> ---- cstc -

I use the following in my .zshrc

function precmd
{
  if jobs % >& /dev/null; then
    psvar=("*")
  else
    psvar=("")
  fi
}

PS1="%~ %!%1v> "

The precmd function is executed before printing a prompt. It checks
whether there are background jobs or not.
The %1v pattern in PS1 means to print the first element of the array
psvar.  If there background jobs, an asterisk is printed. Otherwise, an
empty string is printed.

It works fine for me.

You would just have to modify the precmd to check whether the jobs are
running or suspended and set psvar accordingly.

Regards,

Alain Caron
alainc@sangacorp.com
514-288-4498 ext. 225


      parent reply	other threads:[~1998-10-29 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-29 13:36 Paolo Pumilia
1998-10-29 13:58 ` Zefram
1998-10-29 18:19   ` Dan Nelson
1998-10-29 14:16 ` Alain Caron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=363878CA.27586B27@sangacorp.com \
    --to=alainc@sangacorp.com \
    --cc=pumilia@est.it \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).