January 29, 2006

KDE Tricks - Using DCOP to communicate with AmaroK

Geekitude

Sort of following up on my conversion to Kubuntu and the following of the KDE Way, I learned a couple tricks about KDE this week.

I had been using XMMS as my music player forever and a day. Since I like chattering about what music I'm listening to when I'm on IRC, I wrote a little macro into X-Chat that let me say on channel (or in a msg) what XMMS was currently playing. To do this I used xmms-shell, a command line utility for interacting with XMMS. But since I converted to AmaroK, that obviously wouldn't work anymore.

I started looking around for something similar to xmms-shell for AmaroK, when a fellow on #kde-users suggested looking at the 'dcop' command line tool. I had very little exposure to dcop - I knew it was one of the technologies underlying KDE, but I wasn't sure exactly what it was.

DCOP, according to the wikipedia page on it, stands for " Desktop COmmunication Protocol", and is a light-weight interprocess and software componentry communication system. What this means for the layman is that virtually any application built for KDE has a series of methods and properties exposed for access from a dcop client. KDE provides the command line tool 'dcop' and a GUI desktop tool called, unsurprisingly, 'kdcop' for exploring and using these interfaces. I used kdcop to browse through the AmaroK DCOP remote methods, and found 'nowPlaying()'. It was a simple matter of putting this into an x-chat macro:

/exec -o echo `dcop amarok player 'nowPlaying()'`

Binding that to the 'x' key in x-chat, now at any point I can just type /x and whatever track I'm listening to shows up in the channel or msg window I'm in.


Posted by dbs at January 29, 2006 9:40 AM

Trackback Pings

TrackBack URL for this entry:
http://mt.homeport.org/cgi-bin/mt-tb.cgi/2308

Comments
Post a comment


Note that comments here are moderated, and may not appear immediately.




Remember Me?

(you may use HTML tags for style)

Subscribe without leaving a comment

Email Address:


Linux // Mac Webgame Reviews
Space Worms!
A new 'Grow' game!
Review: Jake2
Planarity - the game!
Review: Tactics Arena

View all games...
Reviews (Most recent 5)
LDAP and Thunderbird
More gloom for Palm, and the X5 Bluetooth Headphones
QuickReview: Synergy2
The URL Game.. An Interview with Jonathan Whiting
Google Browser Sync

View all reviews...
Recent Geekitude
A successful geocache find!
I tried, I really tried.
Kids Programming?
Books on Treo? Sure, why not.
The Squee just keeps on comin...

View all geekery...