Re: dcop questions : I found it (not realy :o( )

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

 



Hi Nicolas,

I use the following to start the konsole and get the PID:

eval "konsole &" > /dev/null
konsole_id="konsole-$!"

You can't use kstart to start the konsole though.

For the case someone is interested, attached is a script that opens a konsole window and opens sessions to a list of hosts (listed in a file) in tabs.

Best regards,
Carsten

Nicolas wrote:
On Friday 02 July 2004 07:31, Kevin Krammer wrote:

On Friday 02 July 2004 06:00, Nicolas wrote:

On Thursday 01 July 2004 22:59, Nicolas wrote:

I found it.  It's not realy clean, but it does the job.

kstart -type Override konsole --script --profile log_no_deco
pid=$(expr $$ + 2)
konsole1=konsole-$pid

then dcop $konsole .....

Nic Cola

the hack works if i only start one konsole. "$$" give the PID of the shell script. I'd need the PID of the konsole...

You can get the PID of a session's shell by DCOP. You could look through all sessions until the you find the PID you got by your construct above.


It's fine if I do it my self (with the mouse and keyboard), but I'd like to place 7 konsoles with 2 differents profiles. Since dcop need the "konsole-$PID" type of string, I need the pid to find my konsole :o)

The big problem with "$$" is the possibility of other process to start before the last konsole is started. I tryed to add a constant number to the base PID to have the PID of the other konsoles, but I always vahe problem with the last ones depending if another process is started.

If I find a solution, I'll post it here.

	Nic Cola


Cheers,
Kevin


#!/bin/sh

USER_HOME="/home/`id -un`"
HOSTS_FILE="$USER_HOME/etc/opentestenv.hosts"
KONSOLE_CONFIG_DIR="$USER_HOME/.kde/share/apps/konsole"
LOGIN_CMD="sudo rlogin"
SESSION_PREFIX="testenv_"
KONSOLE_SCHEMA="Transparent.schema"

#Create console session files for the test machines
make_console_sessions()
{
    rm -f $KONSOLE_CONFIG_DIR/$SESSION_PREFIX*

    typeset i=0;
    while [ $i -lt ${#host[@]} ]
    do
        cat > $KONSOLE_CONFIG_DIR/$SESSION_PREFIX${host[$i]}.desktop << EOF_FILE
[Desktop Entry]
Cwd=
Exec=$LOGIN_CMD ${host[$i]}
Font=
Icon=openterm
KeyTab=
Name=${name[$i]}
Schema=$KONSOLE_SCHEMA
Term=xterm
Type=KonsoleApplication
EOF_FILE
        i=`expr $i + 1`
    done
}


. $HOSTS_FILE

make_console_sessions

# launch konsole with first session and get DCOP application name
eval "konsole --type $SESSION_PREFIX${host[0]} &" > /dev/null
konsole_id="konsole-$!"

# wait until konsole is started and accepts dcop commands
while ! dcop $konsole_id konsole sessionCount 1>/dev/null 2>/dev/null
do
    sleep 1
done

i=1;
while [ $i -lt ${#host[@]} ]
do
    dcop $konsole_id konsole newSession $SESSION_PREFIX${host[$i]} >/dev/null
    i=`expr $i + 1`
done

___________________________________________________
.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux