zsh-users
 help / color / mirror / code / Atom feed
From: "William G. Scott" <wgscott@ucsc.edu>
To: zsh-users@zsh.org
Subject: command completion notification
Date: Fri, 3 Aug 2012 23:08:31 -0700	[thread overview]
Message-ID: <61BB4B35-A02F-44F8-B793-A7F90543D25F@ucsc.edu> (raw)

Forgive me, as it has been a few years since my last email…

In OS X, 10.8 (aka Mtn Lion), Apple has introduced a notification system.  Using gem, I installed a command-line utility called terminal-notifier.

I wrote a simple function to test its capabilities:

function tnot { "$@" && terminal-notifier -message "$( echo $@ ) returned $?" -title "Command $HISTCMD Completed" >|/dev/null }

Now if I issue a command like

tnot  sleep 12

It will post a notification on the screen and log the notification to the so-called notification center where all the nagging notices pile up.

This isn't particularly elegant.  I would rather use this as a preexec function, or something similar, so I wouldn't have to explicitly type "tnot".  However, there are only a small subset of commands I would want to bind to a notification.

Is it straightforward to somehow bind this to, say, control-return, or some other modified return key sequence?

Thanks.

Bill Scott




William G. Scott
Professor
Department of Chemistry and Biochemistry
and The Center for the Molecular Biology of RNA
228 Sinsheimer Laboratories
University of California at Santa Cruz
Santa Cruz, California 95064
USA
 


             reply	other threads:[~2012-08-04  6:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04  6:08 William G. Scott [this message]
2012-08-04 23:10 ` Bart Schaefer
2012-08-05  3:43   ` William Scott
2012-08-05 18:21     ` Bart Schaefer
2012-09-20  9:04     ` Oliver Kiddle

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=61BB4B35-A02F-44F8-B793-A7F90543D25F@ucsc.edu \
    --to=wgscott@ucsc.edu \
    --cc=zsh-users@zsh.org \
    /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).