#!/usr/bin/env xdg-open [Desktop Entry] Name=Dolphin GenericName=File Manager Type=Application Exec=dolphin Icon=dolphin.png Category=System;
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
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 KDERight-click in a directory and choose Create New->Link to Application...:
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: