[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: name sessions in konsole



> Possibly it could be done via DCOP, if you wrapped your local /usr/bin/ssh
> in a script to do that, but I don't know sufficient about DCOP to say
> if it's so.

I'm not sure if this is what you are after here, but (~/bin/ssh):

#!/bin/bash

REAL_SSH=/usr/bin/ssh

if [ ! -z "$KONSOLE_DCOP_SESSION" ]
then

  # Use the last argument as the title
  for arg in $@; do
    NEW_TITLE="$arg"
  done

  OLD_TITLE=`dcop "$KONSOLE_DCOP_SESSION" sessionName`
  dcop "$KONSOLE_DCOP_SESSION" renameSession "$NEW_TITLE"

  function restore_title() {
    dcop "$KONSOLE_DCOP_SESSION" renameSession "$OLD_TITLE"
  }

  # If SSH is interrupted (CTRL-C), restore the old title
  trap "restore_title" SIGINT
  $REAL_SSH $*
  restore_title

else
  $REAL_SSH $*
fi


- Jarno



Reply to: