In this article, we would would cover how to make Desktop entry in Ubuntu. Generally, it used as an Application launcher. First, we need to understand what exactly a Desktop entry is? Only then, we would know what purpose it fulfills. A Desktop entry contains following entries –
- Name,
- Comment,
- Exec,
- Icon,
- Terminal,
- Type and,
- Categories.
So, in a way it provides us the information about an item in the Menu. Apart from that, these also serve as a shortcut for our application. In Ubuntu, we store Desktop entries for user-specific application in
~/.local/share/applications/
and for system-specific application – /usr/share/applications/
Make Desktop entries in Ubuntu
The following just shows what a Desktop entry would look like –
[Desktop Entry] Type=Application/Link/Directory Version=version-number Name=application-name Comment=tooltip Exec=/path/to/executable/executable-name Icon=/path/to/icon Terminal=true/false Categories=menu-categories
Now, understand it with the help of an example. We had tar.bz2 package of Firefox web browser with us. It was downloaded from official website of Firefox. We extracted it to the desired directory. Now, all we wanted was a Desktop entry for the web browser. So, what we did was –
Step I. Opened an empty file with nano text-editor through –
nano
You may opt for any text-editor you like in place of nano, just that we prefer to use nano. Used the following code in it –
[Desktop Entry] Type=Application Version=103.0.2 Name=Firefox Web Browser Exec=/home/$USER/Downloads/firefox/./firefox Comment=A Web Browser Icon=/home/$USER/Downloads/firefox/icons/firefox-logo-nightly.png Terminal=false Categories=Network;WebBrowser;
Here, replace $USER with your systems’ user_name. Save the text file as – Firefox.desktop
Step II. Now, all we need to do is – either move the Firefox.desktop to ~/.local/share/applications/
for user-specific applications. Or, we can go ahead with system-specific ones – /usr/share/applications/
We went ahead with the following directory. So,
mv Firefox.deskop ~/.local/share/applications/
Use sudo while moving Firefox.desktop to /usr/share/applications
For some desktop environments you may have to logout for changes to take effect. Or, reload main menu. We tested it on LXDE, the Firefox menu entry was there in systems’ main menu the moment we copied it to ~/.local/share/applications/
That is pretty much everything we need to do.
In conclusion, we have covered how to make a Desktop entry in Ubuntu here.