Two ways to create application shortcuts under Linux

Source: Internet
Author: User

Two ways to create application shortcuts under Linux:
A. Creating a shortcut on the desktop
B. Add a shortcut to the Application menu

Create a shortcut on the desktop
This is the simplest way to right-click on the desktop and there will be a "create launcher" bar. Here I thought mplayer create shortcuts as an example:
Name-mplayer (or whatever name you like, this name will appear in the shortcut icon
Displayed below
Command-/usr/bin/gmplayer (This is the executable file for the GUI application of MPlayer, with
Installation path related, can be found by which Gmplayer)
Icons-General applications will provide some logos when they are published, usually in the share of the installation directory
can be found below. MPlayer's small icon in
/usr/share/pixmaps/mplayer-desktop.xpm.
Set these three items basically enough, double-click to invoke the application. If you want to know more information, you can switch to the user Desktop directory under the terminal and edit the corresponding desktop configuration file *.desktop.
In fact, in the desktop to create shortcuts there is a way to compare the soil. That is to create a symbolic link that points to the execution file. For example, my mplayer GUI execution file is/usr/bin/gmplayer, directly under the terminal to knock a: Ln-s/usr/bin/gmplayer~/desktop/on it. But here's the problem: When the symbolic link is pointing to a binary file, double-clicking the symbolic link directly invokes the application, but when the symbolic link points to a shell script, the system asks whether it is executed under the terminal, or whether the script is displayed or running, which is very melancholy.

Add a shortcut to the Application menu
Under/usr/share/applications there is a bunch of *.desktop files, each of which is a configuration file in the menu for a particular application. First look at the contents of Gaim.desktop:
[Desktop Entry]
Encoding=utf-8
Categories=application; Network; X-red-hat-base;

Exec=gaim
Icon=gaim.png

Startupnotify=true
Terminal=false
Type=application

Genericname=internet Messenger
Genericname[ca]=missatger d ' Internet
........

Comment=send instant messages over Multipleprotocols
Comment[ca]=envieu missatges Instantanis en múltiplesprotocols
........

Name=internet Messenger
Name[ca]=missatger d ' Internet
Name[cs]=internet Messenger
name[zh_cn]= Internet Communication Program

Gaim is the system comes with, after installing the system can be found under the application->internet. If you installed a program, how to add it to the menu, such as I installed Acroreader, now want to put it in the application--Office. You can create a new Acroread.desktop file under/usr/share/applications with the following content:
[Desktop Entry]
Name=acroread
Encoding=utf-8
Exec=/usr/local/adobe/acrobat7.0/bin/acroread

Icon=/usr/local/adobe/acrobat7.0/resource/icons/adobereader.png

Terminal=false
Type=application
Categories=application;office;

Comment[zh_cn]=pdf Document Viewing tool

In addition to the/usr/share/applications can be placed in the desktop configuration file, some applications of desktop configuration files in other places, such as/usr/local/share/applications, I suspect that these two places will be scanned by the system, So put it in any place that should be effective, and the former priority may be higher.

from adding shortcuts to your application This simple operation can be seen, as a good software developer, should always pay attention to standardization, attention to user convenience. So when the user Makeinstall, to ensure that the execution of files in path can be found in the paths, and many people are ignoring the icon should also be copied to the system default directory/usr/share/pixmaps.

Two ways to create application shortcuts under Linux

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.