Connect KDE applications with DCOP

Source: Internet
Author: User
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

  1. Start kdcop from the terminal or KDE menu bar.
  2. In the application list, expand "kwin" (KDE window manager ).
  3. Now, expand "KWinInterface" to display all functions provided by the interface.
  4. You can double-click the functions to execute them. For example, double-clickrefresh(), 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

  1. Start kdcop from the terminal or KDE menu bar.
  2. 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.
  3. In the application list, expand "konqueror-NNNNN ".
  4. Expand "KonquerorInterface" to display all functions provided by the interface.
  5. Double-clickopenBrowserWindow().
  6. 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.
  7. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.