Ubuntu18.04 Desktop Entry

1. What is Desktop Entry?

We all know that when software is installed in Windows, it will ask whether to create shortcuts in the start menu and desktop, so that you don't have to go to the installation directory to start when using the software, but go directly to the start menu and click the corresponding software shortcut. way. There are similar functions in Linux: Desktop Entry files, Linux GNOME and other desktop desktop systems use Desktop Entry files to describe program startup and configuration information.

I use Ubuntu18.14 here (it was installed just two days ago, it is much more beautiful than 16.04, haha), use the following command to cd to the directory where the system saves the Desktop Entry file

cd /usr/share/applications

ls take a look at the files in the application directory:

As shown in the figure above, the Desktop Entry files are suffixed with ".desktop", and these files describe the startup information of the applications installed on Ubuntu 18.04 (very similar to the shortcuts in the Start menu on Win).

Open all application browsers (start menu of Ubuntu version), we can see many application icons, click the corresponding icon to open the application, in fact, each application icon here corresponds to a ".desktop" in the application directory in the above figure ” file, for example: only if there is a configuration file called firefox.desktop in /usr/share/applications, there will be an icon of the software in the application browser, and we can open the FireFox browser through the application browser.

 That is to say, the system will go to the /usr/share/applications directory to read the ".desktop" file, and then add a shortcut to start the application in the application browser according to the file configuration.

So here comes the question:

What is the format of the Desktop Entry file?

Will software that I manually install myself appear here automatically?

2.Desktop Entry file format

Take the firefox browser as an example, use the cat command to see what the ".desktop" file corresponding to the firefox browser looks like:

cat firefox.desktop

 In fact, it is a bunch of assignment information. Some important fields are as follows:

[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=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-window
Actions=new-window;new-private-window;

 In fact, you can get a rough idea just by looking at the name. Name is the name, Version is the version, and Icon is the icon~~~

 For the meaning of all fields, you can go to the reference link at the end of this article to find it, which is not listed here.

 

 

Reference link:

IBM:https://www.ibm.com/developerworks/cn/linux/l-cn-dtef/index.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325015099&siteId=291194637