[comp.sys.amiga] title bar hack

rmariani@watmum.waterloo.edu (Rico Mariani) (01/19/88)

Just a comment on all of this console title bar hacking in shells
and whatever.  It seems like a really neat idea to put something
useful in the title bar instead of the dumb NewCLI message but
we're going about this all wrong.  Don't hack the shell...
write a command called 'settitle' that places it's arguments in
the title bar.  Then I can alias whatever commands I like to
put whatever I want in the title bar whenever I feel like it.
Make this a shell built in if you're really gung ho but you
don't have to do this to make it usable.  Maybe have it read
stdin for one line if there are no arguments or if a flag
is set.  

I'd like to

alias cd '%var cd $var;settitle $var'

or maybe to some slick trick like

date >ram:foo ; settitle <ram:foo

Let's build good tools, not ugly kludges.

	-Rico

page@swan.ulowell.edu (Bob Page) (01/21/88)

rmariani@watmum.waterloo.edu (Rico Mariani) wrote:
>Don't hack the shell...write a command called 'settitle' that places
>it's arguments in the title bar.

I agree.  Bill Hawes' new WShell (coming soon) has a zillion options
on the prompt, one of them is 'execute this file'.  He supplies a
program called cdtitle that puts the current dir name in the title
bar.  It's small and resident-able (his version of resident does
checksumming) so doesn't cost much.

>Then I can alias whatever commands I like to put whatever I want in
>the title bar whenever I feel like it.
...
>alias cd '%var cd $var;settitle $var'

Of course this idea is better than building it into the prompt, as you
don't need to run the titling program after each command.

>Let's build good tools, not ugly kludges.

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
"I don't know such stuff.  I just do eyes."  -- from 'Blade Runner'

dillon@CORY.BERKELEY.EDU (Matt Dillon) (01/21/88)

>I agree.  Bill Hawes' new WShell (coming soon) has a zillion options
>on the prompt, one of them is 'execute this file'.  He supplies a
>program called cdtitle that puts the current dir name in the title
>bar.  It's small and resident-able (his version of resident does
>checksumming) so doesn't cost much.

	Awww.  Steve took a really neat feature out of my shell.
MY shell's (the original) _prompt variable holds a *command* rather than a
prompt string... usually set to "echo -n "% "", but settable to ANYTHING, 
including executing a sequence of commands, shell scripts, or whatever you 
want.

				-Matt

louie@trantor.umd.edu (Louis A. Mamakos) (01/21/88)

One thing to keep in mind 'bout the title bar hack for the current directory
is that not all CLI/Shells will be running in a window.  Don't forget about
the various AUX: drivers, and maybe even a TELNET server..

Perhaps if we agree that the ACTION_INFO packet should return a NULL where
the window pointer normally is.  Then the various applications could skip
the SetWindowTitles().



Louis A. Mamakos  WA3YMH    Internet: louie@TRANTOR.UMD.EDU
University of Maryland, Computer Science Center - Systems Programming

kaz@cadovax.UUCP (Kerry Zimmerman) (01/23/88)

In article <2206@umd5.umd.edu> louie@trantor.umd.edu (Louis A. Mamakos) writes:
>One thing to keep in mind 'bout the title bar hack for the current directory
>is that not all CLI/Shells will be running in a window.  Don't forget about
>the various AUX: drivers, and maybe even a TELNET server..
>
>Perhaps if we agree that the ACTION_INFO packet should return a NULL where
>the window pointer normally is.  Then the various applications could skip
>the SetWindowTitles().
>

SetWindowTitles() may not be the correct way to change a CLI/shell window's
title.  Why? Because this routine will point the window's Title pointer
to someplace in the caller's process space.  When the calling process
exits, the Title pointer will be pointing at nothing useful.  Next time
the window needs refreshing, the nice title you had will probably be
replaced by garbage characters.

You really need do something like strcpy() the title to where the CLI's
window title is currently pointing.  I personally would not recommend
this, because we don't have the source to the CLI and don't know how
much space is reserved for its window title.  But, just using
SetWindowTitle() is not a proper solution to changing the CLI's title
bar.

Kerry Zimmerman
#  {ucbvax,decvax}!trwrb!cadovax!kaz  Contel Business Systems 213-323-8170
A difference between an amateur and a professional, 
is that a professional has the right tools.

dillon@CORY.BERKELEY.EDU.UUCP (01/23/88)

:SetWindowTitles() may not be the correct way to change a CLI/shell window's
:title.  Why? Because this routine will point the window's Title pointer
:to someplace in the caller's process space.  When the calling process
:exits, the Title pointer will be pointing at nothing useful.  Next time
:the window needs refreshing, the nice title you had will probably be
:replaced by garbage characters.

	SetWindowTitles() is the ONLY way to change the title properly.
Come on people, get some brains! (That was not directed at this particular
poster).  You simply save the old title pointer(s), set the new one, and then
restore the old one when you exit.

				-Matt

cks@radio.toronto.edu (Chris Siebenmann) (01/24/88)

In article <2206@umd5.umd.edu> louie@trantor.umd.edu (Louis A. Mamakos) writes:
...
>Perhaps if we agree that the ACTION_INFO packet should return a NULL where
>the window pointer normally is.  Then the various applications could skip
>the SetWindowTitles().

 Why not simply have them bounce the packet with an ACTION_NOT_KNOWN
error?  This is easy to program and doesn't require trusting people to
check the window value you return. It also makes sense, since the only
reason to send an ACTION_DISK_INFO packet to a console-like handler is
to get the window address. If people want to know whether they're
running interactively or with redirected input, they can always use
IsInteractive().

-- 
	"I shall clasp my hands together and bow to the corners of the world."
			Number Ten Ox, "Bridge of Birds"
Chris Siebenmann		{allegra,mnetor,decvax,pyramid}!utgpu!radio!cks
cks@radio.toronto.edu	     or	...!utgpu!{chp!hak!ziebmef,ontmoh}!cks

rokicki@rocky.STANFORD.EDU (Tomas Rokicki) (01/25/88)

> One more time I'm saying this: THIS WON'T WORK WITH CONMAN!!!  That's why
> my CD program I posted a while ago won't work with it.  It seems the designer
> of Conman didn't see this one.  If this would work, then my CD program would
> too, and everyone would be happy, right?
> 
> Please, could somebody tell Bill Howes about this?  Thanks.

I just spoke with Bill on the phone last night, and he says that this problem
has been solved for quite some time.  I'm running conman 1.0, and I've had no
problems at all.  Version 1.0 is on fish disk 100; try it out, and if it
doesn't solve your problems, let me know (415) 326-5312.  At the moment, I
believe conman works with everything, including `less' (which someone else
complained about, but again I've had no problems) and it is perhaps my most
recommended piece of shareware for the Amiga.

-tom

kaz@cadovax.UUCP (Kerry Zimmerman) (01/26/88)

In article <8801231929.AA12560@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>:SetWindowTitles() may not be the correct way to change a CLI/shell window's
>:title.  Why? Because this routine will point the window's Title pointer
>:to someplace in the caller's process space.  When the calling process
>:exits, the Title pointer will be pointing at nothing useful.  Next time
>:the window needs refreshing, the nice title you had will probably be
>:replaced by garbage characters.
>
>	SetWindowTitles() is the ONLY way to change the title properly.
>Come on people, get some brains! (That was not directed at this particular
>poster).  You simply save the old title pointer(s), set the new one, and then
>restore the old one when you exit.
>
>				-Matt

Matt, I think you missed something.  

Some people would like run a utility that changes the title bar of the
CLI and then exits, leaving the title bar changed.  If you use
SetWindowTitles() only, the utility can not exit, or it must change the
title bar back (as you pointed out).  Since the purpose of the utility
is to change the title, it wouldn't make sense to change it back.

If you are running a Shell in the CLI window, then the shell can change
the title bar, and change it back when the user quits the shell.  But
for someone who is not running a program in the CLI window, but just
wants to change the window title, using SetWindowTitles() alone is not
the answer.

Kerry Zimmerman
#  {ucbvax,decvax}!trwrb!cadovax!kaz  Contel Business Systems 213-323-8170
A difference between an amateur and a professional, 
is that a professional has the right tools.