Most applications provide one, but occasionally you’ll need to create one.
It’s quite easy, just run with this.
Desktop Files
Desktop files contain information about the tool or script they belong to.
fatmawati achmad zaenuri/Shutterstock.com
They’re most often used withbinary executables, but you could use them with ascripttoo, should you wish.
For brevity, we’re just going to say “utility.”
Because desktop files are stored in standard locations, yourdesktop environmentcan reliably locate and reference them.
If an program doesn’t have a desktop file some of its integration with your desktop environment will fail.
It’s this use-case that gave them their name.
Downloading an utility as source code andcompiling it on your computeroften doesn’t create a desktop file.
The Construction of a Desktop File
A desktop file is a plain text file.
They can be created using any text editor.
If it runs, that’s great.
you could go ahead and make your desktop file.
The program we’re working with has an executable calledtaflocated in the “/usr/local/bin/taf/” directory.
We’ll launch the tool to ensure it starts up without any issues.
The program launches just fine.
That simple test yields useful knowledge.
A fully-working desktop file doesn’t have to contain very much information.
Here’s the desktop file we created for thetafapplication.
It’s called “taf.desktop.”
This is what each of the lines means.
To avoid this you could use theupdate-desktop-databasecommand.
You’ll need to usesudowhen you do.
There’s also a utility to check your desktop file for correctness.
If it detects any syntax or other errors it’ll report them to you.
We’re going to copy it to the “/usr/share/applications/” directory.
We’ll also ensure our new desktop file is read and has its metadata added to the database.
The “Super” key is usually located between the left-hand “Ctrl” and “Alt” keys.
Pressing the “Super” key in GNOME enters the utility search.
Clicking the icon launches the tool.
The system has been integrated nicely into the desktop environment.
Its icon is correctly displayed in the dock while it runs.
Pointing to the icon displays a tooltip containing the full name of the app.
Clicking the icon shows the window preview view, showing the windows that the tool has opened.
Right-clickingthe software icon produces a context menu.
Selecting the “Add to Favorites” option pins the software to the dock.
The system icon is moved above the separator line and becomes a permanent icon on the dock.
The icon is present even when the utility is not running.
Go Native
Users expect to be able to do certain things with desktop applications.
They expect the tool to be listed in search results.
A surprising number of these interactions are controlled by desktop files.
It sure beats launching the app by hand each time.
Related:How to Be More Productive in Ubuntu Using Keyboard Shortcuts