It's a small thing, but I noticed today that when I'm using Yakuake, KDE's nice roll-down terminal program, the titles of the tabs don't reflect where I'm currently logged in. I also seemed to remember it using this information before, so I decided to investigate.

KDE's fantastic reusable components technology, KParts, means that Yakuake is basically a wrapper around the Konsole KPart, and the behaviour was the same in Konsole itself. The Konsole KPart offers up a nice configuration dialog, which allows you to construct tab titles from bits of information, such as your username, the host, the program currently running, and any title the program itself might want to set. And, you can set different options for local and remote (eg. SSH) sessions.
I realised that the remote version of the tab title wasn't being used when I was logged in to a remote machine using SSH. To cut a long story short, it appears that Konsole only "realises" that you're in a remote session when you actually start the remote session using the actual command 'ssh'. I'd constructed a one-line shell script, with a short name, to avoid having to type in my username and the full doman name every time. As the SSH session was started from the shell script, Konsole hadn't realised that I was actually in a remote session.
This was soon remedied, by making sure to 'exec' ssh, rather than just stating it from the script:
ssh -X username@host
becomes
exec ssh -X username@host.
For those not familiar with the command 'exec', it basically passes control of the current process to the what's being called (ssh in this case), rather than waiting in the shell for ssh to return. Using this, when I start my remote session from the shell script, the Konsole part recognises that SSH is in fact being run, and updates the tab title accordingly.

Comments
Another trick that might be
Another trick that might be helpful to you here, would be utilizing the file ~/.ssh/config:
#==== FILE =====
Host peteO
ForwardX11
User username
Hostname petesodyssey.org
#==== END FILE ====
This method would allow you to issue the command as `ssh peteO`
Nice, thanks! I didn't know
Nice, thanks! I didn't know about that option.
Post new comment