You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

koia

Beginner

  • "koia" started this thread

Posts: 2

Location: Stockholm

Occupation: Former Engineer

  • Send private message

1

Monday, November 27th 2006, 5:19pm

DCOP unstable when opening windows with many tabs

Hi,

This script code was earlier presented in this forum for opening a new konsole with multiple tabs. I have added some prints to it since then.

KONSOLE=`dcop | grep konsole`
echo "Existing konsoles:\n$KONSOLE"
konsole --script -e man ls &
sleep 5
KONSOLE=`dcop | grep konsole | tail -n 1`
echo "New konsole: $KONSOLE"
SESSION=`dcop $KONSOLE konsole newSession`
echo "Konsole is same?: $KONSOLE"
echo "New session: $SESSION"
sleep 1
dcop $KONSOLE $SESSION sendSession "man ps"

It worked for some times, but now suddenly it does not, then it can work again after restarting PC. I do not see why.

The konsole text output from echo resulting from running the script is following:

root@martin:~/vnuml/tests/t1# ./vnuml_konsole2.sh
Existing konsoles:\nkonsole-12189
New konsole: konsole-12189
Konsole is same?: konsole-12189
New session: session-4
no such function
root@martin:~/vnuml/tests/t1#

You can see that the konsole identity after calling konsole for a new window has not changed. I get a new window with man ls comand running, but I get two tabs not in the new window but in the konsole window I started the script from and there is no display from man ps command.

How shall I change the script to get a stable funcition?

Regards, koia
koia

koia

Beginner

  • "koia" started this thread

Posts: 2

Location: Stockholm

Occupation: Former Engineer

  • Send private message

2

Thursday, November 30th 2006, 6:32pm

RE: DCOP unstable when opening windows with many tabs

Hi,

If somenone happens to read my question to the forum why the script I used did not provide tabs in the new opened konsole window I found out myself after some time.

Using the command "KONSOLE=`dcop | grep konsole`", DCOP provides a list of the open konsole windows, but the identity of the newest console, i.e. the one that is started from my script does not necessary appear in the last line of the list. This was assumed in the script I found on web. Neither is the newest konsole terminal assigned to the highest id number.

I needed to do a perl script to extract the new line in DCOP output due to my better skills in perl than in bash shell scripting. If someone has a nice way to extract the new added line with the new konsole id from DCOP output in bash, I am interested.

Regards, Ingmar
koia