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.

DanGentry

Beginner

  • "DanGentry" started this thread

Posts: 2

Location: Seattle, WA

  • Send private message

1

Friday, January 6th 2006, 11:38pm

New konsole tabs via konsole - HELP!?!?!

Hey gang - thought I'd ask for a hint on this one:

I'm trying to do the standard "use dcop to open tabs for all of my sessions" trick, like so:

#!/bin/sh
konsole=$(dcopstart konsole-script)

echo "Started konsole $konsole..."
session=$(dcop $konsole konsole newSession)
echo "Created session $session..."
dcop $konsole $session renameSession Music
echo "renamed $session to Music..."
dcop $konsole $session sendSession "cd /dang/Music"

So, open a konsole, create an additional tab called Music. Send a command "cd /dang/Music" command to that tab, then enter.

Simple, no?

Unfortunately, when I run the script, the window pops, the new tab is created .... and it just sits at the prompt. If I click on the window and hit a key - return, or whatever else you like, any key really - then the command is sent and everything works.

This doesn't seem like a big problem, except I want this to be automated. I'm using FC4 x86_64, and kde 3.4.2.

Any hints?

Thanks!

Dan

2

Saturday, January 7th 2006, 11:38am

RE: New konsole tabs via konsole - HELP!?!?!

If you also send a return, the command is executed. In this case, your script will look like:

Source code

1
2
3
4
5
6
7
8
9
10
#!/bin/sh
konsole=$(dcopstart konsole-script)

echo "Started konsole $konsole..."
session=$(dcop $konsole konsole newSession)
echo "Created session $session..."
dcop $konsole $session renameSession Music
echo "renamed $session to Music..."
dcop $konsole $session sendSession "cd /dang/Music
"

DanGentry

Beginner

  • "DanGentry" started this thread

Posts: 2

Location: Seattle, WA

  • Send private message

3

Monday, January 9th 2006, 4:55pm

RE: New konsole tabs via konsole - HELP!?!?!

Well, yes, you'd think that works, but no - it doesn't. I've added various forms of return ( ctrl-v return, \r , \n , etc ) to no avail. Thanks for the suggestion, but no fix.

Another interesting tidbit: If I use kdcop, find an existing konsole, and use sendSession to set a command - it works as advertised. Similarly, if I modify the script pasted here to use an existing konsole, everything works.

Unfortunately, this isn't quite what I'm looking for.

Any one have any other suggestions? Is this a problem with some semi-obscure KDE setting, or window focus behavior, sunspots, gamma radiation, ... ?

Dan

4

Monday, January 9th 2006, 5:47pm

RE: New konsole tabs via konsole - HELP!?!?!

I do use a simular script, with the difference that I use pidof to find out which pid the newly started konsole have. I also have a "sleep" command before sending commands. Here are the important parts of the scripts I use:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
PIDS=`pidof konsole`

kstart --maximize konsole --script

ARGS=""
for pid in $PIDS; do
        ARGS="${ARGS} -o ${pid}"
done
PID=`pidof ${ARGS} konsole`

sleep 2

for nr in 2 3 4; do
        dcop konsole-${PID} konsole newSession
done

dcop konsole-${PID} session-1 renameSession kdelibs
#Some more sessions renames

dcop konsole-${PID} konsole sendAllSessions "newgrp kde"
dcop konsole-${PID} konsole sendAllSessions "umask 0002"


I have also tested your script and it seems to work here (kde 3.5).

stfs

Beginner

Posts: 3

Location: Iceland

Occupation: Software Engineer

  • Send private message

5

Tuesday, April 17th 2007, 2:57pm

EDITED: nevermind... my question wasn't valid and it works like a charm now!

For the record, I'm not having any trouble with having to send an eol with the command... the command string seems to be enough for me. I'm running Kubuntu (6.10) with the KDE 3.5.6 packages from (http://kubuntu.org/packages/kde-356/).

Kind regards, Stefan Freyr.

This post has been edited 1 times, last edit by "stfs" (Apr 17th 2007, 3:19pm)