Renaming a Konsole session from commandline after ssh
Asked Answered
M

1

4

I use dcop to rename a Konsole session, such as

dcop $KONSOLE_DCOP_SESSION renameSession "whatever"

However, when I ssh to a server and from there, I issue this command, it does not work and gives error:

ERROR: Couldn't attach to DCOP server!

Is there a way using dcop or otherwise to rename the Konsole session, even though I have ssh'ed to another computer.

Millda answered 8/1, 2012 at 22:57 Comment(0)
S
8

The remote server appears not be running dcop and even if it were, that's not the instance you want to be communicating with (dcopserver on the remote host vs dcop on your local host).

You can use XTerm escape sequences to change the title via:

remotehost $ echo -ne "\033]0;Custom Window Title\007"

You can also change the individual tab title via:

remotehost $ echo -ne "\033]30;Custom Tab Title\007"

Another way would be to suspend your current ssh session so that you are back at the login you started.

e.g.

host1 $ ssh host2
host2 $ ~^Z [suspend ssh]

[1]+  Stopped                 ssh host2
host1 $ dcop $KONSOLE_DCOP_SESSION renameSession "whatever"
host1 $ fg
ssh host2
host2 $ 
Serous answered 8/1, 2012 at 23:18 Comment(1)
If you want to change both the title of the window and the tab in the Konsole session try echo -en "\e]30;Title Here\a" instead. Results in this: i.sstatic.net/cN8mY.pngHeathen

© 2022 - 2024 — McMap. All rights reserved.