What is 1.Desktop Entry?
As we all know, the software in Windows asks whether you want to create a shortcut in the Start menu or desktop, so you don't have to install the directory when you use the software, but instead go to the Start menu and click on the appropriate software shortcut. There are similar features in Linux: Desktop entry files, desktops such as Linux Gnome are used to describe program startup and configuration information using desktop entry files.
I use the Ubuntu18.14 (the first two days just released on the loaded, compared to 16.04 pretty many ah, haha), use the following command CD to the system to save the directory of desktop entry files
Cd/usr/share/applications
LS look at the files under the application directory:
As shown, the Desktop Entry file is suffixed with ". Desktop", which describes the startup information for the application installed on Ubuntu18.04 (very similar to the shortcut in the Start menu on win).
Open all application browser (Ubuntu version Start menu), we can see many app icons, click the corresponding icon to open the app, in fact, each app icon here corresponds to a ". Desktop" file in the application directory, for a chestnut: only in/usr /share/applications has a configuration file called Firefox.desktop, the app browser will have the icon of the software, we can open the Firefox browser via the application browser.
That is, the system will go to the/usr/share/applications directory to read the ". Desktop" file, and then add a shortcut to launch the application on the application browser based on the file configuration.
So here's the question:
What is the format of the Desktop entry file?
Does the software I manually install automatically appear here?
2.Desktop Entry file format
Take the Firefox browser example and use the Cat command to see what the ". Desktop" file looks like for your Firefox browser:
Cat Firefox.desktop
is actually a bunch of assigned information, some of the important fields are as follows:
[Desktop entry]version=1.0Name=Firefox Web browsercomment=Browse the world Wide webgenericname=Web browserkeywords=Internet; WWW; Browser; Web; Explorerterminal=falseX-multipleargs=falseType=ApplicationIcon=firefoxcategories=GNOME; GTK; Network; WebBrowser; MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif; Image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome ; video/webm;application/x-Xpinstall; Startupnotify=True
Exec=firefox-new-windowActions=New-window;New-Private-window;
In fact, just look at the name can also know a general, name is the name, version is the edition, icon is the icons ~ ~ ~
For all the field meaning, you can go to the last reference link in this article to find, here is not listed.
3. How to add a shortcut to the Application Manager by manually installing the software
Unfortunately, the software we install on Ubunt is not automatically added to the application manager, such as Eclipse, which can be used without a setup.exe to help you finish everything.
So, how to add it up?
It's easy to create a ". Desktop" file in the/usr/share/applications directory.
The first step: for example, I installed Eclipse
Part II: Create a new file named "Eclipse.desktop" in the/usr/share/applications directory and fill in the fields based on the actual content (location, type, etc.) of the software installation.
At this point, the app browser will have the Eclipse's shortcut icon (upper-right corner)
About categoruies This field to say:
Cat/etc/xdg/menus/application.menu
Cd/usr/share/desktop-directories
refer to the last script house of this article
-----------------------------------
Reference Links:
Ibm:https://www.ibm.com/developerworks/cn/linux/l-cn-dtef/index.html
Script House: http://www.jb51.net/os/RedHat/523235.html
Ubuntu18.04 Desktop Entry