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

Re: command completion notification

On Aug 3, 11:08pm, William G. Scott wrote:
} 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.
} 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.

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.

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

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).

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