Creating Desktop Files with Examples | Linux Today

Creating Desktop Files with Examples

Written By
Web Webster
Web Webster
Mar 7, 2014

Desktop files are intended as shortcuts to applications. They are plain text files ending in the .desktop extension and following a standard format. Here is a simple example of a desktop file to launch Dolphin, the KDE file manager:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Dolphin
GenericName=File Manager
Type=Application
Exec=dolphin
Icon=dolphin.png
Category=System;

xdg-open is a program that will open a file in the preferred application.

In the above example we have only several fields, but they are enough to contain everything needed to know about the program:

The Name field specifies the name of the application
The GenericName field specifies a description of the application
The Type field specifies the type of the application
The Exec field specifies the executable program or script to be launched when running the desktop file
The Icon field specifies the icon to be used by the desktop file

Example of editing a desktop file:

Usually desktop environments will recognize a desktop file and display its name from the Name section instead of the filename which could be something like launch-dolphin.desktop.

All you have to do is create such a desktop file using a text editor like Gedit or Nano, and also make sure to give execute permissions to your desktop file, e.g. chmod 755 launch-dolphin.desktop, so the program xdg-open will be ran automatically. You can then drag and drop your desktop files on the desktop or to a panel.

Here is an example for running an application in System Tray using the AllTray program, using the command alltray dolphin:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Dolphin (SysTray)
GenericName=File Manager
Type=Application
Exec=alltray dolphin
Icon=dolphin.png
Category=System;

AllTray is an application docker and it will integrate any graphical application in the system tray. For terminal applications, follow the next example.

Or, for example to run a terminal application, using alltray konsole -e irssi, which will launch Konsole and start up the IRC client Irssi inside it:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Irssi
GenericName=File Manager
Type=Application
Exec=alltray konsole -e irssi
Icon=xterm.png
Category=Internet;

Creating a Desktop File in KDE
Right-click in a directory and choose Create New-Link to Application…:
In the General tab, choose the name of your shortcut and then click the icon button to choose an icon for your launcher:
In the Application tab, fill in the Name, Description and Command fields:

That is all. If you right-click your desktop file now and open it with a text editor, it should look something like this, pretty much the same as creating it manually:
By Craciun Dan on March 07, 2014 | Updated: March 07, 2014 | v0.2.0 r1

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.