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!