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

Re: command completion notification

Dear Bart:

Thanks for writing back. and  for your advice.

On Aug 4, 2012, at 4:10 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> There was a thread from last October about using growl for this same
> sort of thing.  See http://www.zsh.org/mla/users/2011/msg00798.html
> and surrounding conversation.

The site is down, but I will take a look when I can.  I was in fact using growl, 
but never got beyond this.  I wound up aliasing a few commands to run growl-notify.
I wouldn't mind a general solution, as growl probably isn't going to disappear.
> There are two issues here:
> (1) Your terminal emulator (I presume just the MacOS terminal app) must
> send a recognizable different character or key sequence when you press
> control-return -- I'm not in front of my Mac so can't test that now.
> (2) It depends on what you want the binding to do.  For example, to
> simply insert "tnot" in front of the current command and then run it:
> tnot-widget() { BUFFER="tnot $BUFFER"; zle accept-line }
> zle -N tnot-widget
> and then bindkey for whatever character is sent by control-return, to
> the tnot-widget.
> I expect you're going to have more trouble with (1).

You suspected correctly.  (2) worked like a charm, and am embarrassed since I read that chapter in your book last night.

I'm still trying to figure out how to do (1) in some reasonably elegant manner. I'm using iTerm, since it is a bit more amenable to zsh scripting control than terminal, and it in fact has a built-in growl notification, but it is overkill, so I wind up turning it off.

Maybe I am taking a stupid approach.  What would be ideal is if a user could specify a time in seconds beyond which the notification would be issued.  I am most interested in this for processes that take minutes to hours, rather than a few seconds to run in the foreground, and it would also be nice for background processes as well.

Thanks for setting me on the right track.

-- Bill

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