In centos 5.5, manually create a "shortcut" for the application in the System menu"

Source: Internet
Author: User

In centos 5.5, manually create a "shortcut" for the application in the System menu"
9 minutes ago label: shortcut centos manual menu Linux
The word "shortcut" is used in windows. However, it shows a menu item on the interface. After you click it, window applications, such as browsers and terminal windows, will be opened.
In centos5.5, each menu item is described in a text file under the path/usr/share/applications. These files are called "desktop configuration files" and named XXXXX. desktop. The suffix indicates the desktop. If the Desktop configuration file is located here, you can create a symbolic link to point to it. The file name format of the symbolic link is xxxxxx. desktop.
For example, under the application/programming group, there is a menu item "AT-SPI Browser" with a file name that is a fedora-sniff.desktop. Since it is a text file, let's open it with the gedit Text Editor:
[Root @ localhost applications] # gedit fedora-sniff.desktop
The content is as follows:
[Desktop entry]
Version = 1.0
Encoding = UTF-8
Name = AT-SPI Browser
Name [en_ca] = AT-SPI Browser
Name [en_GB] = AT-SPI Browser
Comment = browse your custom Ive technology-enabled Desktop
Comment [en_ca] = browse your dedicated Ive technology-enabled Desktop
Comment [en_GB] = browse your dedicated Ive technology-enabled Desktop
Exec = sniff
Terminal = false
Type = Application
Icon = dogtail-head.svg
Startupnotify = true
Categories = application; development; X-fedora;
X-desktop-file-install-version = 0.10
Genericname [zh_cn] =
Clear and irrelevant things are not explained at a Glance. Let's look at the important points:
Name = AT-SPI browser defines the text displayed for the menu item. Name [en_ca] And name [en_GB] define strings in other languages.
Exec = sniff defines the name of the executable file, that is, the application to be opened.
Icon = The dogtail-head.svg defines the icon displayed before the menu text.
Categories = application; development; X-fedora; defines the menu group, which corresponds to the "Application/programming" menu item.
Let's look at an example. Flashget for Linux is also installed in my centos and under "application/Internet" in the System menu. Open the Desktop configuration file flashget. desktop to check the text content:
[Desktop entry]
Version = 1.0.2
Encoding = UTF-8
Name = flashget
Comment = Internet Express
Exec =/usr/bin/flashget
Icon =/usr/share/flashget/flashget.png
Terminal = false
Type = Application
Categories = application; Network; flashget;
Startupnotify = true
Name [zh_cn] = Internet Express flashget
Genericname [zh_cn] = Internet Express flashget
Comment [zh_cn] = Internet Express flashget
The executable files and desktop configuration files are all copied to their respective paths during RPM package installation. Let's refer to the file distribution in the RPM package:
[Root @ localhost Home] # rpm-qlp flashget-1.0.2-0_cn.noarch.rpm
Warning: flashget-1.0.2-0_cn.noarch.rpm: Header V3 DSA Signature: nokey, key ID 29c8d3f0
/Usr/bin/flashget
/Usr/share/applications/flashget. Desktop
/Usr/share/flashget/readme
/Usr/share/flashget
/Usr/share/flashget/flashget.png
It is indeed consistent with the menu configuration file. What files are contained in the RPM package and where the files are installed are determined by the software author based on their needs and requirements. Then use the RPM packaging tool to generate the software package. The flashget. desktop file can be edited manually or generated using software, but must be copied to the specified path according to the requirements of different versions of Linux.
After learning about the above xuanjicang, We can manually create corresponding system menu items for "green" software, such as QQ for Linux, for ease of use.
For example, my navicat9.0.12 (MySQL management client) is located in the/home/navicat9_mysql_en path. The executable file is/home/navicat9_mysql_en/start_navicat (Note: Running Based on wine ), so I created a text file navicat under/usr/share/applications. desktop, the content is as follows:
[Desktop entry]
Version = 9.0.12
Encoding = UTF-8
Name = navicat9.0.12
Comment = navicat9.0.12-MySQL Database Manager
Exec =/home/navicat9_mysql_en/start_navicat
Icon = dogtail-head.svg
Terminal = false
Type = Application
Categories = application; development; navicat;
Startupnotify = true
Name [zh_cn] = navicat9.0.12 MySQL Database Manager
Genericname [zh_cn] = navicat-MySQL Database Manager
Comment [zh_cn] = navicat-MySQL Database Manager
As a result, the menu item "navicat9.0.12 MySQL Database Manager" appears under the "Application/programming" menu group. Click it to open the navicat for MySQL Database Manager program.
You can imagine that creating a desktop configuration file is simple and often repetitive. it is best to start it with a development tool. However, development tools are also developed by people. programmers can write development tools only after clarifying these rules. The program was initially born to replace repetitive and complex work.
Note: For further exploration, you need to know where "application; development;" is defined. If an application needs to create its own menu group, you need to understand this.
Author: Zhang Qing (mesh) Xi'an PHP Education Training Center
From mesh horizon: http://blog.why100000.com
Author Weibo: http://t.qq.com/zhangking
Why 100,000 computer learning networks: http://www.why100000.com

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.