Automatically rename KONSOLE tab during telnet or ssh.
I am using KDE konsole as my primary terminal interface.
To keep tab organized I am using wrapper script for telnet and ssh where I am calling dcop to change the tab name with a with a host name:
#!/bin/sh
telnet_log=/tmp/telnet.log.$$
restore_title()
{
if [ "${OLD_TITLE}x" != "x" ]
then
dcop "$KONSOLE_DCOP_SESSION" renameSession "$OLD_TITLE"
OLD_TITLE=
fi
}
change_title()
{
if [ ! -z "$KONSOLE_DCOP_SESSION" ]
then
OLD_TITLE=`dcop "$KONSOLE_DCOP_SESSION" sessionName`
dcop "$KONSOLE_DCOP_SESSION" renameSession "$NEW_TITLE"
fi
}
handle_quit_intr()
{
restore_title
}
trap handle_quit_intr SIGINT INT QUIT
for arg in $@
do
NEW_TITLE="$arg"
done
OLD_TITLE=
export OLD_TITLE
export NEW_TITLE
change_title
/usr/bin/telnet $* 2> $telnet_log
rc=$?
restore_title
echo "telnet exit with code $rc"
if [ $rc -eq 0 ]
then
[ -f $telnet_log ] && rm -f $telnet_log
exit 0
fi
exit $rc
no comments yet.
GDB Cannot access memory at address … »« Roubo Volumes Now Available in the United States
