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

How to determine konsole tab name?



I want to be able to run different startup sequences when starting my 
desktop that contains konsole windows with multiple tabs.  For example, 
in a window with tabs hosta and hostb, I want my startup script to "ssh 
hosta" and "ssh hostb" in their respective tabs.  I can find a list of 
all tabs for the parent window, but can't discriminate among them.

As this is at startup, the tab running the script may not be the active 
one.

I  wrote the following, which gets me almost there:
========================================
#!/bin/sh

SHELLPID=`ps -p $$ -l | tail -1 | awk "{ print \\\$5 }"`
KONSPID=`ps -p $SHELLPID -l | tail -1 | awk "{ print \\\$5 }"`

#printf "Shell is $SHELLPID, konsole is $KONSPID\n"

SESSIONS=`dcop konsole-$KONSPID | grep ^session`

for SESSION in $SESSIONS; do
  SNAME=`dcop konsole-$KONSPID $SESSION sessionName`
  echo Session $SESSION name is $SNAME
done
========================================

but I have no way to associate $SHELLPID with a session name.  If there 
were a DCOP interface to the shell's PID, I could just compare each 
session's result.

Any ideas?  It's OK that the script functions only for local windows.
-- 
Rob



Reply to: