[CLUG-tech] ERROR: Couldn't attach to DCOP server!

Jonathan Hitchcock vhata-clug at rucus.ru.ac.za
Wed Feb 15 09:55:24 SAST 2006

Nolan Rumble wrote:
> What's the function of dcop in the kde gui?

It's the Desktop COmmunication Protocol.  It's a bit like dbus for KDE, 
and the whole Corba thing in Gnome.  It lets apps communicate between 
each other.  'dcop' itself is a sort of command-line interface to it.

You need a dcop server running - this should be started up automatically 
when a KDE app (or KDE itself) starts running.

> Does the /usr/bin/dcop binary need any special permissions?

It needs to be executable?

 > Would the binary be affected if it's executed from a remote ssh shell
 > (under root) or from a the user's console (under the root account?)?

It's just a client.  It will talk to the user's dcop server.  I suspect 
that, since it is the user who logs in to KDE, the dcop server belongs 
to the user, so the dcop client should be run as the user.  Why are you 
running arbitrary binaries as root, when you don't even know what they 
do?  And why are you ssh'ing as root?

I run Gnome, so there's no dcop server running by default.  However, I 
luuurve the amaroK music player, so I put up with the extra bloat of the 
KDE libraries.  When I run amaroK, it starts the dcop server automatically:

18995 vhata Feb 13  17:13  0.6 amarokapp
19044 vhata Feb 13   0:19  0.0 kded [kdeinit]
19029 vhata Feb 13   0:00  0.0 dcopserver [kdeinit] --nosid --suicide
19020 vhata Feb 13   0:00  0.0 kdeinit Running...
19033 vhata Feb 13   0:00  0.0  \_ klauncher [kdeinit]

Now, I can run dcop:

$ dcop

It tells me that there are four applications registered with the dcop 
server and listening for dcop commands.  I can use introspection to find 
out what they do:

$ dcop amarok
player (default)

Okay, the 'player' bit looks interesting:
(I'm snipping bits for brevity's sake)

$ dcop amarok player
QCStringList interfaces()
QCStringList functions()
bool isPlaying()
bool randomModeStatus()
bool repeatPlaylistStatus()
bool repeatTrackStatus()
int getVolume()
int sampleRate()
int trackCurrentTime()
int trackPlayCounter()
int trackTotalTime()
QString album()
QString artist()
QString nowPlaying()
QString path()
void enableRandomMode(bool enable)
void enableRepeatPlaylist(bool enable)
void enableRepeatTrack(bool enable)
void mediaDeviceMount()
void mediaDeviceUmount()
void mute()
void next()
void pause()
void play()
void playPause()
void prev()

A whole bunch of functions!  Let's see what I'm listening to:

$ dcop amarok player nowPlaying
Cypress Hill - I Ain't Goin' Out Like That

Aha!  I'm a middle class white boy pretending to be a gangster.  How 
long has this sorry state of affairs been going?

$ dcop amarok player currentTime ; dcop amarok player totalTime

Let's skip this song:

$ dcop amarok player next

There you have it.

More information about the Clug-tech mailing list