zsh-workers
 help / color / mirror / code / Atom feed
From: "Alain Caron" <alainc@nortel.ca>
To: zsh-workers@math.gatech.edu
Subject: Printing command and arguments on xterm frame.
Date: 20 Dec 1996 09:53 EST	[thread overview]
Message-ID: <199612201854.NAA28948@euclid.skiles.gatech.edu> (raw)


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


                 reply	other threads:[~1996-12-20 19:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=199612201854.NAA28948@euclid.skiles.gatech.edu \
    --to=alainc@nortel.ca \
    --cc=zsh-workers@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).