Article title: use DCOP to connect to the KDE application. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Each KDE Desktop (from version 2.0) contains a little-known but very powerful component called "Desktop COmmunication Protocol" or "DCOP. from the developer's point of view, using DCOP can easily add powerful script functions to your application. From the user's perspective, DCOP can easily control your KDE applications and combine them in an interesting and powerful way.
What is DCOP?
In essence, DCOP is a lightweight inter-process communication mechanism that operates on sockets. DCOP consists of a server (dcopserver, which is automatically started when KDE is started) and any number of clients (applications supporting DCOP. DCOP clients can send messages to each other (through the server) to request information and execute functions. For example, Konqueror may (indeed) send a DCOP message To KMail To start a new window. fill in the "To" field of the new window when you click the "mailto" link.
Use DCOP
To help us use DCOP, KDE desktop comes with two useful tools: dcop and kdcop.
Kde dcop browser -- kdcop
This is a graphical tool. after running, you can list all DCOP clients running on the machine and display them in a tree view. Then, each client can be expanded to show which interfaces it supports.
Figure 1. use DCOP
This can be further expanded until the expected function is found. Double-click the function to call it (if you need a parameter, you will be asked ).
Example 1. refresh the desktop
- Start kdcop from the terminal or KDE menu bar.
- In the application list, expand "kwin" (KDE window manager ).
- Now, expand "KWinInterface" to display all functions provided by the interface.
- You can double-click the functions to execute them. For example, double-click
refresh()
, And then you will see the desktop refreshed, double-clicknextDesktop()
, The display will switch to the next virtual desktop.
Example 2. open a new Konqueror window
- Start kdcop from the terminal or KDE menu bar.
- Make sure that you have a Konqueror instance running-if it is not displayed in the list, start a new instance. It should be displayed as "konqueror-NNNNN", where NNNNN is the PID of the Konqueror process.
- In the application list, expand "konqueror-NNNNN ".
- Expand "KonquerorInterface" to display all functions provided by the interface.
- Double-click
openBrowserWindow()
.
- A dialog box is displayed, asking you to provide a URL parameter. Enter a complete URL (for example, "http://www.ibm.com/") and click" OK.
- Now you should see a new browser window directed to the URL you specified.
Figure 2. enter the URL
Figure 3. pop up your favorite site
Kdcop is an excellent tool that can be used to discover interfaces supported by an application. the second standard tool, simply called "dcop", can better meet the needs of daily work.
[1] [2] [3] [4] Next page