[Konsole-devel] Controlling konsole with dbus

Robert Knight robertknight at gmail.com
Sun Feb 7 12:42:11 UTC 2010


Hello,

>  But i don't have any reference about the newly created window
> nor do i know, how to control this specific window.

Indeed.  It looks as though the new window will try to register an
interface at /Konsole and then fail
since one already exists.

If your script is running from a terminal then running konsole will
start a new process with one window
which can be accessed via org.kde.konsole-$PROCESS_ID.

> How can i find the newly created tabs and execute a specific command in
> it?

The newSession DBus call returns the ID of the tab/session.  You can
then execute commands
using the sendText method of that session.

qdbus org.kde.konsole /Sessions/$sessionId sendText "<command> <new line>"

> I can't find any good documentation about dbus & KDE - it's problematic
> to use dbus, if there's no documentation.

Freedesktop.org contains information about DBus in general.
You can use qdbusviewer to inspect the interfaces provided by each
application, call
methods and so on.  I'm afraid I don't know of any good documentation
to recommend
on how to do specific things with DBus in KDE.

Regards,
Robert.

On 7 February 2010 00:03, Andreas 'ads' Scherbaum <adsmail at wars-nicht.de> wrote:
>
> Hello all,
>
> i'm trying to port a script from KDE3/dcop to KDE4/dbus and ran into
> some issues and missing functionality. Even the people from the #kde
> irc channel could not help here.
>
> In short, what i want to do: open a new konsole window, resize the
> new window, create several new tabs, execute a command in each tab.
>
> Here's what i used back in KDE3 days with dcop:
>
>
> # start a new konsole window
> konsole=$(dcopstart konsole-script)
>
> # maximize the new window
> dcop $konsole konsole-mainwindow#1 maximize
>
> # get current session for the first (just created) window
> thissession=$(dcop $konsole konsole currentSession)
>
> # create another konsole tab
> newsession=`dcop $konsole konsole newSession "ssh -t $s"`
>
> # start the command
> dcop $konsole $newsession sendSession "exec <command>"
>
>
> The script is way more complex, i just broke this example down to the
> basic functionality.
>
>
>
> I know that i can start a new konsole window with the following command:
>
> qdbus org.kde.konsole /MainApplication newInstance
>
> But i don't have any reference about the newly created window nor do i
> know, how to control this specific window.
>
> With:
>
> qdbus org.kde.konsole /Konsole newSession
>
> i can create a new tab - but this tab is always created in the very
> first konsole window. How can i create a new tab in my newly created
> window?
>
> How can i find the newly created tabs and execute a specific command in
> it?
>
>
> I can't find any good documentation about dbus & KDE - it's problematic
> to use dbus, if there's no documentation. Given that dbus seems to be
> the replacement for dcop and controls almost everything in KDE4, this
> isn't a good start for writing applications.
>
>
>
> Thank you & kind regards
>
> --
>                                Andreas 'ads' Scherbaum
> Failure is not an option. It comes bundled with your Microsoft product.
>  (Ferenc Mantfeld)
> _______________________________________________
> konsole-devel mailing list
> konsole-devel at kde.org
> https://mail.kde.org/mailman/listinfo/konsole-devel
>



More information about the konsole-devel mailing list