BBS:      TELESC.NET.BR
Assunto:  Re: Titles in lxterminal
De:       Gordon Henderson
Data:     Fri, 20 Feb 2026 11:00:01 +1100
-----------------------------------------------------------
In article <10n7fpe$3lun8$2@dont-email.me>,   wrote:
>Gordon Henderson  wrote:
>> In article <10n560g$2u42e$1@dont-email.me>,   wrote:
>>>From time to time I get badly confused about which terminal window does what.
>>>This is on a Pi5 running bookworm, if it matters.
>> 
>> This is on "generic Linux" if it matters:
>> 
>> In ~/bin I have an executable script:
>> 
>> #!/bin/sh
>> 
>> if [ "x$*" = x ]; then
>>   echo -n "\033];`hostname`\007"
>> else
>>   echo -n "\033];$*\007"
>> fi
>> 
>> I call it 'xtt' (xterm title - works in xterm and other terminals I use)
>> You make it yours and call it what you like.
>> 
>> So xtt on it's own resets the title to your hostname (handy if you login
>> to many systems) othrwise it sets the title to whatever you put on the
>> command line
>> 
>>   xtt silly editing session
>> 
>> for example
>> 
>> Your challenge is to make it work automatically for every command
>> you type.. (I don't need that functionality, I use it inside other
>> scripts that start stuff)
>> 
>This suggestion might touch on a fundamental issue: Which host,
>the ssh client or the ssh server, gets to set the window or tab
>title on the client machine running RasPiOS? I've been thinking
>it's the RasPiOS machine displaying the window or tab. If I'm
>understanding you correctly it's the server end of the connection.
>Is that correct?

It's whatever you want it to be. In my case it's the client - which to
avoid ambiguity is the system I type the ssh command on...

>I'm working with only one RasPiOS workstation client and several
>FreeBSD servers. I'd rather customize the workstation than the
>servers, if that's possible. 

Well... `hostname` returns the name of the host the script is running
on.

One way I use it is in scripts that ssh to remote systems, so rather
than type ssh frotz, I type 'frotz' which is a script in my ~/bin
directory and that script looks like:

#!/bin/sh
xtt '-> Frotz'
  ssh gordon@frotz.drogon.net $*
xtt

This sets the title of the xterm I'm typing into to '-> Frotz' then
runs the ssh to the server...

When the ssh exits (ie. I logout of Frotz), the xtt command with no
arguments resets the terminal title bar to that on whatever host I typed
the command at. (either my desktop or laptop)

Gordon

--- PyGate Linux v1.5.11
 * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)

-----------------------------------------------------------
[Voltar]