DCOP, which stands for
Desktop COmmunication Protocol, is a light-weight
interprocessInter-process communication is a set of techniques for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and...
and software componentry communication system. The main point of this system is to allow
applicationsApplication software is a computer program that functions and is operated by means of a computer, with the purpose of supporting or improving the software user's work. In other words, it is the subclass of computer software that employs the capabilities of a computer directly and thoroughly to a...
to interoperate, and to share complex tasks. Essentially, DCOP is a ‘remote control’ system, which allows an application or a script to enlist the help of other applications. It is built on top of the
X Window SystemThe X Window System is a computer software system and network protocol that provides a graphical user interface for networked computers, and was initially developed as part of Project Athena...
’s Inter-Client Exchange protocol.
The use of DCOP provides extensive new capabilities, without requiring entirely new applications to be written, as might otherwise be the case.
DCOP, which stands for
Desktop COmmunication Protocol, is a light-weight
interprocessInter-process communication is a set of techniques for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and...
and software componentry communication system. The main point of this system is to allow
applicationsApplication software is a computer program that functions and is operated by means of a computer, with the purpose of supporting or improving the software user's work. In other words, it is the subclass of computer software that employs the capabilities of a computer directly and thoroughly to a...
to interoperate, and to share complex tasks. Essentially, DCOP is a ‘remote control’ system, which allows an application or a script to enlist the help of other applications. It is built on top of the
X Window SystemThe X Window System is a computer software system and network protocol that provides a graphical user interface for networked computers, and was initially developed as part of Project Athena...
’s Inter-Client Exchange protocol.
The use of DCOP provides extensive new capabilities, without requiring entirely new applications to be written, as might otherwise be the case.
KDEKDE is a free software project based around its flagship product, a desktop environment mainly for Unix-like systems. The goal of the project is to provide basic desktop functions and applications for daily needs as well as tools and documentation for developers to write stand-alone applications...
applications and the KDE
librariesIn computer science, a library is a collection of subroutines or classes used to develop software. Libraries contain code and data that provide services to independent programs. This allows the sharing and changing of code and data in a modular fashion. Some executables are both standalone programs...
make heavy use of DCOP and most of the KDE applications can be controlled by scripts via the DCOP mechanism. DCOP was replaced by
D-BusD-Bus is a simple inter-process communication system for software applications to communicate with one another. D-Bus was heavily influenced by KDE2–3's DCOP system and has replaced it in the KDE 4 release; it is supported on Linux, Microsoft Windows and Apple Mac OS X operating systems and...
in
KDE 4KDE 4 is the current series of releases of the K Desktop Environment. The first major version of this series was released on January 11 2008, and the latest major version was released on August 4 2009....
.
In modern KDE systems, every KDE application supports a basic set of DCOP interfaces, even if the programmer of the application did not explicitly code in such support. For instance, every application automatically supports the “quit” command to close the application.
There is a command-line tool called ‘dcop’ (note the lower-case letters) that can be used for communication with the applications from the shell. ‘kdcop’ is a
GUIA graphical user interface is a type of user interface item that allows people to interact with programs in more ways than typing such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment with images rather than...
tool to explore the
interfacesInterface generally refers to an abstraction that an entity provides of itself to the outside. This separates the methods of external communication from internal operation Interface generally refers to an abstraction that an entity provides of itself to the outside. This separates the methods of...
of an application.
For example, the KDE desktop provides a way to display different wallpapers at timed intervals. However, it does not directly provide an interface for changing to the next wallpaper, if the current one does not fit your mood. Neither does it provide a way of permanently removing desktop wallpapers that you decide you do not like, after seeing them as actual wallpaper on your screen.
These features can be added in a few moments, however, using dcop. The command:
$ dcop kdesktop KBackgroundIface changeWallpaper
will switch to the next wallpaper from a shell, and the command:
$ dcop kdesktop KBackgroundIface currentWallpaper 1
will get the filename of the wallpaper on desktop 1. (KDE, and most X environments, support multiple ‘virtual’ desktops for organizing work.) By combining the two in a short
shell scriptA shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...
, you can switch to the next wallpaper, then delete the previous wallpaper, like so:
OLDWALLPAPER=`dcop kdesktop KBackgroundIface currentWallpaper 1`
dcop kdesktop KBackgroundIface changeWallpaper
rm "$OLDWALLPAPER"
As you can see, DCOP makes it possible to add new features that were never envisaged when an application was first created.
DCOP Model
The model is simple. Each application using DCOP is a client. They communicate to each other through a DCOP server, which functions like a traffic director, dispatching messages/calls to the proper destinations. All clients are peers of each other.
Two types of actions are possible with DCOP: "send and forget" messages, which do not block, and "calls," which block waiting for some data to be returned.
Any data that will be sent is serialized (also referred to as
marshalling in
CORBAChorba , shurpa , sorpa , or shorpo is one of various kinds of soup or stew found in national cuisines across Eurasia. The term is likely of Persian or Turkic origin.- Turkey :...
speak) using the built-in QDataStream operators available in all of the
QtQt is a cross-platform application development framework, widely used for the development of GUI programs , and also used for developing non-GUI programs such as console tools and servers. Qt is most notably used in KDE, Google Earth, Skype, Qt Extended, Adobe Photoshop Album, VirtualBox and OPIE...
classesIn object-oriented programming, a class is a construct that is used as a blueprint to create objects of that class. This blueprint describes the state and behavior that the objects of the class all share. An object of a given class is called an instance of the class. The class that contains that...
. There is also a simple IDL-like compiler available (dcopidl and dcopidl2cpp) that generates stubs and skeletons. Using the dcopidl compiler has the additional benefit of
type safetyIn computer science, type safety is a property of some programming languages that is defined differently by different communities, but most definitions involve the use of a type system to prevent certain erroneous or undesirable program behavior...
.
D-BusD-Bus is a simple inter-process communication system for software applications to communicate with one another. D-Bus was heavily influenced by KDE2–3's DCOP system and has replaced it in the KDE 4 release; it is supported on Linux, Microsoft Windows and Apple Mac OS X operating systems and...
, a message bus system standardized by
freedesktop.orgfreedesktop.org is a project to work on interoperability and shared base technology for free software desktop environments for the X Window System on Linux and other Unix-like operating systems. It was founded by Havoc Pennington from Red Hat in March 2000.The organisation focuses on the user....
, was heavily influenced by the DCOP system and replaces DCOP in
KDE 4KDE 4 is the current series of releases of the K Desktop Environment. The first major version of this series was released on January 11 2008, and the latest major version was released on August 4 2009....
.
External links