Scripting Yakuake
August 22nd, 2008 | by richfreedman |Yakuake has become an integral part of my desktop over the years. It’s a drop-down terminal emulator, reminiscent of the old Quake console. It supports multiple tabs. When doing software development, this comes in very handy.
At the moment, I have it running with 4 tabs – one running tomcat with the app that I’m working on, with logging to the console, one with a CAS server, one running an ssh tunnel into the CVS server, and one with a shell for general-purpose use. All at the touch of the F-12 key. Great stuff.
This morning, I was feeling even more lazy than usual, and got to wondering whether I could script Yakuake to open those four tabs, and run the requisite commands in them, from a shell script.
As with most things in Linux, if you can imagine it, it’s probably possible, and if it’s truly useful, there’s a good chance that someone else has already done it.
It turns out that Yakuake supports DCOP, the KDE Desktop COmmunications Protocol (Yakuake is a KDE app, but I run it in GNOME, and it works fine).
With Yakuake’s DCOP interface, you can open new tabs, run commands in them, switch tabs, etc.
These, and some other commands are documented in a few places (including some references on the Yakuake home page), but many of the commands are not. To browse the full interface, you can use the ‘kdcop’ program.
Here’s some of the things that you can do with this:
* Add a new session (a new tab, with a new terminal):
dcop yakuake DCOPInterface slotAddSession
* Change the caption on the tab of the current session:
dcop yakuake DCOPInterface slotRenameSession `dcop yakuake DCOPInterface selectedSession` "tomcat"
* Run a command in the current session:
dcop yakuake DCOPInterface slotRunCommandInSession `dcop yakuake DCOPInterface selectedSession` "~/tomcat/bin/startup.sh"
* Select a specific tab:
dcop yakuake DCOPInterface slotSelectTabPosition 0
I understand that in the latest versions, Yakuake has switched over from DCOP to DBUS.
That’ll be another new adventure…..in the meantime, enjoy being lazy!

5 Responses to “Scripting Yakuake”
By El motinak on May 23, 2009 | Reply
Where did you learn this?? :-D I mean, is there a list with all dcop options somewhere?
In particular, I was wondering if it’s possible to split terminal from command-line (I’m using Yakuake 2.81 and kde 3.5.10).
By the way, thanks for the post. It was very useful for me.
Greetings from Chile (sorry for my bad english).
By richfreedman on May 25, 2009 | Reply
El motinak,
Im glad that you found the post helpful.
As I mentioned in the article, I used the ‘kdcop’ program to browse the yakuake’s dcop interface.
After that, it was just trial-and-error.
By the way, I had trouble with yakuake on one of my computers (something to do with the video driver), and so switched to Guake [ http://trac.guake-terminal.org ] on that machine. Guake is fairly similar, and has recently expanded it’s dbus interface (at my request – http://trac.guake-terminal.org/ticket/109 ) to incorporate much of the same functionality.
By Amir Tahvildaran on Jan 6, 2010 | Reply
Hey Rich,
I adapted your DCOP version to dbus, the qdbus program is pretty nice for exploring dbus functions
Here’s a snippet:
sess=`qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId`
qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommand ‘cd /opt/tomcat && bin/startup.sh’
qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.splitSessionLeftRight $sess
qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommand ‘cd /opt/tomcat && tail -f logs/catalina.out’
qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle $sess ‘tomcat’
Take care,
-Amir
By richfreedman on Jan 10, 2010 | Reply
Amir,
Good to hear from you!
I had some problems with Yakuake a while back, and switched over to Guake, which is written for Gnome (Yakuake is a KDE app).
Guake is very similar to Yakuake, but has been more stable and well-behaved under Gnome. Unfortunately, it doesn’t have as rich of an automation interface as Yakuake, but at my request, the author is kindly expanding Guake’s dbus interface.
Also, at the client that I have been working with for the last few months, Windows is mandated as the development environment :-( I installed Cygwin to get a bash shell and openssh, etc., and then found Wuake. Same general idea as Yakuake / Guake. Not pretty, but gets the job done.
See you at ETE?
By myso on Feb 11, 2010 | Reply
check out this: for adding new tabs
http://88.191.25.234/wordpress/2009/05/09/yakuake-launch-on-start/