konsole window title change in SSH session
Dear all,
I would like the window title and if possible also the tab title of the KDE terminal program konsole to change to the name of the remote host when I start an SSH session. Would that be possible? thanks, Steven |
Yes it is.
I wrote a little shell script which changes a konsole tab title, and prints out the old value. Code:
#!/bin/bash Code:
#!/bin/bash |
thanx, that is exactly what I needed. I made a minor change to your script so that the tab title shows the hostname. In case anybody is interested:
Code:
# This script is called "kssh". DO NOT call it ssh or it |
I got help from the posts. I'd like to contribute something hopefully also useful.
1. It's not necessary to name "kssh" differently from ssh, if you use the full path, say /usr/bin/ssh in "kssh". This saved me from the "oops, should have use kssh, not ssh" moments. 2. dcop works for me only on the machine I launched konsole. (Got this kind of errors: [sw18-0216t]sw18:$VIEW_ROOT>dcop --user jshau --session .DCOPserver_swvnc3.kickfire.com__50 SocketUNIXConnect: Cannot connect to non-local host swvnc3.kickfire.com DCOPClient::attachInternal. Attach failed Could not open network socket SocketUNIXConnect: Cannot connect to non-local host swvnc3.kickfire.com DCOPClient::attachInternal. Attach failed Could not open network socket ERROR: Couldn't attach to DCOP server! ) But I'd like to be able update the tab name as I continue to ssh to other machines, or more importantly to me, as I use svn views. I need to do something a bit complicated as follows. * All the following is done only for interactive shell (e.g. check the prompt variable). o Upon shell startup, (including use svn view in my case) if KONSOLE_DCOP_SESSION is defined and first time for this terminal, = mkdir -p ~/rdcop/`tty`; let it be TTY_DIR = launch a background process, which - save its pid in a file in TTY_DIR - periodically (e.g. 1 sec) set the session tab name with the last line in file <TTY_DIR>/tabname.stk. - self clean up if the tty no longer in /dev/pts. append the desired tab name to <TTY_DIR>/tabname.stk. also save it in an env var for this shell process. o In "kssh", mainly need to let the login shell in the remote machine to know which <TTY_DIR> to use. I just saved it in a file ~/rdcop/<remote hostname>, followed by sync(1) to make to sure the remote shell will pick it up reliably. o I have two flavors of "popping" tabname.stk: popping to the given tab name (saved in env var), inclusively or exclusivly. Use the inclusive version upon logout of login shell (in .logout for tcsh). I use the exclusive version when the popping needs to be done by "the parent", e.g. # cde useview is my command to use svn view; # pop_konsole_tabname.pl is a script of mine; # + means exclusively with tab name given in env var. [sw18-0216t]sw18:$VIEW_ROOT>alias setview cde useview !:1; pop_konsole_tabname.pl + It would be nice if there's a much simpler way. |
Got to the Settings->Edit Current Profile,
then click on the tabs tab. Change your 'Tab Title format' and 'Remote tab title format' to %w This will use your PS1 setting on whichever machine you are on. Hope that helps.... |
All times are GMT -5. The time now is 09:50 AM. |