Questions tagged [.desktop]

A .desktop file is a launcher. When run, it executes a command, which usually launches an application. Use this tag if you are asking a question about using a .desktop file or about the .desktop file format in general.

A .desktop file (MIME type: application/x-desktop) is a text file (editable in virtually any text editor like , or , for example) that is used to create program launchers on systems running the X Windowing System. More formally, a .desktop file is a configuration file standardized in the Desktop Entry Specification. It is usually used as an application launcher, which may appear in a menu, on a desktop, or in search results. Application launchers that appear on the Unity left sidebar all appear in one of two possible places: /usr/share/applications or ~/.local/share/applications.

Structure

It has the following basic structure:

[Desktop Entry]
Key1=Value1
Key2=Value2
Key3=Value3
.   .   . (and so on)

Where Key(i) (where i=1,2,3,...,n) and Value(i) can be one of a fixed set described here.

Common keys

  • Categories

    This is an optional field that refers to what type of application the launcher is. Like an educational application (e.g., , , , etc.) would have the category Education. Each category is separated by a semicolon (;).

  • Comment

    This is an optional field that provides a short description of the program the desktop file launches.

  • Exec

    This is what the launcher runs through bash. For example, Exec=scilab would run , if it is installed. This field is mandatory if Type=Application.

  • GenericName

    This is a more generic name (like a group name for the set of applications to which the application belongs) for the application. For example, may have GenericName=Text editor, likewise might have the same GenericName value, that is, Text editor. This key is optional.

  • Icon

    This is the icon given to the launcher. Desktop configuration files by default take their icons from /usr/share/pixmaps/, /usr/share/icons/ and ~/.local/share/icons/, although if you specify the full path of the icon you want you may use icon files outside these directories. These icons can be in a range of different file formats including, but not limited to, .gif, .jpg, .png, .svg and .xpm. This field is optional; if it is omitted an icon like that below will be used in its place.

    Vivacious-Colors application-blank icon

  • Keywords

    This is an optional field that serves as metadata for the desktop entry.

  • MimeType

    This is an optional field that is used to determine which files it will appear in the "Open With" for. For example, if MimeType=text/plain then if this desktop file is saved in the /usr/share/applications or ~/.local/share/applications directories it will appear in the open with menu for all plain text files (e.g., those with the file extension .txt).

  • Name

    This is the name with which the icon is displayed (e.g., if Name=gedit then your launcher will be called gedit). This field can be specified for different languages too, for example, you may have one line Name[en_US]=GNOME Colors that is the Name that appears for the launcher when you are using US English and another line Name[en_AU]=GNOME Colours for if you are using Australian English. This key is mandatory.

  • Terminal

    This field can be either Yes or No and refers to whether or not the program is to be run in the terminal. It is optional and its default value is No.

  • Type

    This is a mandatory field that can only take on three values Application, Link or Directory. It refers to the nature of the launcher, that is, what it does, like whether it serves as a link to a file or folder, or whether it runs an application.

1052 questions
293
votes
22 answers

How can I create launchers on my desktop?

In older versions it was easy to create a launcher on my desktop. All I had to do is right click on my desktop and select the "create launcher" option. How can I create such launchers now?
tinuz
  • 3,952
122
votes
3 answers

What does the StartupWMClass field of a .desktop file represent?

I am working on this pre-existent .desktop file and I have a doubt: The file content is: [Desktop…
AndreaNobili
  • 4,539
  • 10
  • 26
  • 36
36
votes
13 answers

.desktop files not launching from desktop in Ubuntu 20.04 LTS

I have just created a .desktop shortcut on my desktop to launch a shell scrip. The script itself works fine, but its shortcut that doesn't display the icon and double-clicking on it just displays its content in gedit: [Desktop…
Alvaro
  • 363
26
votes
2 answers

Can ~/.local/share/applications override /usr/share/applications?

I need to launch some applications on KDE with some added config changes. The best way to do that without messing up with / is by copying .desktop file of individual applications, that I need to change config of, from /usr/share/applications, add…
21
votes
1 answer

Cannot launch .desktop files (opens with Text Editor instead)

For some reason, I cannot launch .desktop files. When I double-click the file, it opens the Text Editor. The desktop file has "Allow executing file as program" turned on (-rwx). In the tab "Open with", the Text Editor is the default application.…
Liga
  • 531
13
votes
1 answer

What's the point of a .desktop file with NoDisplay=true

From what I read browsing askubuntu, a .desktop file in /usr/share/applications/ is useful for creating a shortcut to opening an application. However, there are many more .desktop files in this folder than there are applications in my Show…
Chris Z
  • 301
12
votes
3 answers

How to add an application icons to the desktop in 14.04?

How does one add an application icon to the desktop in verson 14.04? Thank you for your time.
JamesKB
  • 213
9
votes
0 answers

Use desktop-file-install to uninstall?

I installed a desktop file using desktop-file-install now I changed my mind and I want to remove it, can I use desktop-file-edit to manage the installed desktop files? I particularly want to use desktop-file-install or desktop-file-edit Because I…
Shayan
  • 1,503
8
votes
2 answers

What is important when assigning an app to a .desktop launcher?

I have been learning Tkinter, so I took some of my Python programs and made them work in a window. By chance, I saw this way of launching a Python program on Stack Overflow, so I tried it. Then I made an icon and put this code in…
Pedroski
  • 375
6
votes
1 answer

Login as root on ubuntu desktop

How do we turn on root desktop login? I set the root password then modified /etc/gdm3/custom.conf [Security] AllowRoot=true This is not giving me the option of the root at login screen, neither it accepts my root credentials. Credentials are…
Majoris
  • 185
5
votes
1 answer

What is #!/usr/bin/env xdg-open in desktop file?

I created a simple desktop file to check the connectivity of remote location in which Exec=ping 192.168.0.9. But one file created with #!/usr/bin/env xdg-open before Desktop Entry and another without #!/usr/bin/env xdg-open and both worked the same.…
d a i s y
  • 5,511
5
votes
0 answers

How can I get a change to a .desktop file get recognized by Unity/Gnome?

Unity/Gnome does not appear to pickup changes to .desktop files automatically (in particular the "Name" and "Icon" fields). I have found update-desktop-database, but that seems to update the MIME database only (and does not look into…
blueyed
  • 8,965
5
votes
2 answers

How do I make a .sh file run in terminal by default - problem using .desktop file

I have a small .sh file which I use to convert batches of picture files. I just copy this little file into the folder and run it to convert all the pictures in the folder. This works great but it bugs me that it brings up the "Run in…
J D
  • 51
4
votes
1 answer

error: value "5.1.2" for key "Version" in group "Desktop Entry" is not a known version

I have built the latest version of Paraview from source and I am trying to add the desktop file to the dash. Running sudo desktop-file-install /opt/ParaView5.1.2/Applications/ParaView/paraview.desktop Produces the…
Codey McCodeface
  • 323
  • 1
  • 3
  • 11
4
votes
1 answer

Invalid .desktop file

I have a simple script I want to be able to run from a Desktop entry on Ubuntu 19.10. I followed these directions and created a .desktop file but I'm getting an error saying it is invalid. Here is the error Here is the script #!/usr/bin/env…
flashburn
  • 213
1
2 3 4 5