zsh-workers
 help / color / mirror / code / Atom feed
* Printing command and arguments on xterm frame.
@ 1996-12-20 14:53 Alain Caron
  0 siblings, 0 replies; only message in thread
From: Alain Caron @ 1996-12-20 14:53 UTC (permalink / raw)
  To: zsh-workers


I just upgraded to zsh-3.0.2 and there is some functionality I have
been wanting from zsh for quit a while:

Whenever a command is run, I would like to have the command and its
arguments to be displayed on the xterm titlebar and the icon bar.

Currently, I do it for some commands, like less, with the following
function:

function less()
{
xtitle "${HOST}: $0 $*"
command $0 $*
}

where xtitle is a function that updates the xterm titlebar and icon
title.


For some specific cases, I do the following:

xtitle "command args"; command args

which gives me the wanted result.  When I use several xterms on
different machines, this gives me the information I need to quickly
retrieve the appropriate xterm.

I would like zsh to do this for me automatically...

I thought about using the precmd function, but it does not work as
precmd is executed before printing the prompt, therefore before the
command and its arguments are known.

I wonder if there already is a mechanism in the current version of zsh
that would allow me to have the xterm titlebar updated for the
duration of the command.  I suspect the answer is no.

If it is not the case, I would propose to have a function, let's call
it pre-cmd-hook, that if defined, is invoked after the command is entered
but before executing it.

Maybe, after the zle extension proposed by Zefram, there is no need
for the precmd2 function.  Binding the ^J and ^M keys to a zle
function that prints the command line and call accept-line would do
the trick.

Any comment, idea, suggestion on this?  Does it seem to be a good idea
to implement the pre-cmd-hook stuff or is it better to wait until the
zle expension is released?

If the zsh community thinks it is a good idea to implement
pre-cmd-hook stuff, I will try to implement it.  That will be my first
attempt to modify zsh code :-)


Merry Xmas to everyone.


Alain Caron,
email: alainc@nortel.ca
phone: 514-765-7718

"Violence on television only affect children whose parents behave like
TV characters" - David Byrne


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-12-20 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-20 14:53 Printing command and arguments on xterm frame Alain Caron

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