knowledge/technology/files/Desktop Entry.md

59 lines
2.6 KiB
Markdown
Raw Normal View History

2023-12-04 10:02:23 +00:00
---
arch-wiki: https://wiki.archlinux.org/title/desktop_entries
obj: concept
2024-03-06 12:15:41 +00:00
extension: "desktop"
mime: "application/desktop"
2023-12-04 10:02:23 +00:00
---
2024-03-06 12:15:41 +00:00
2023-12-04 10:02:23 +00:00
# Desktop Entry
2024-01-17 08:44:04 +00:00
The [XDG Desktop Entry specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) defines a standard for applications to integrate into application menus of desktop environments implementing the [XDG Desktop Menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html) specification.
2023-12-04 10:02:23 +00:00
## Basics
2024-01-17 08:44:04 +00:00
Each desktop entry must have a `Type` and a `Name` key and can optionally define its appearance in the application menu.
2023-12-04 10:02:23 +00:00
The three available types are:
### Application
2024-01-17 08:44:04 +00:00
Defines how to launch an application and what MIME types it supports (used by XDG MIME Applications. With XDG Autostart Application entries can be started automatically by placing them in specific directories. Application entries use the `.desktop` file extension.
2023-12-04 10:02:23 +00:00
### Link
2024-01-17 08:44:04 +00:00
Defines a shortcut to a `URL`. Link entries use the `.desktop` file extension.
2023-12-04 10:02:23 +00:00
### Directory
2024-01-17 08:44:04 +00:00
Defines the appearance of a submenu in the application menu. Directory entries use the `.directory` file extension.
2023-12-04 10:02:23 +00:00
## Application entry
2024-01-17 08:44:04 +00:00
Desktop entries for applications, or `.desktop` files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in `/usr/share/applications/` or `/usr/local/share/applications/` for applications installed system-wide, or `~/.local/share/applications/` for user-specific applications. User entries take precedence over system entries.
2023-12-04 10:02:23 +00:00
### File example
2024-01-17 08:44:04 +00:00
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [freedesktop specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys).
2023-12-04 10:02:23 +00:00
```ini
[Desktop Entry]
# The type as listed above
Type=Application
# The version of the desktop entry specification to which this file complies
Version=1.0
# The name of the application
Name=jMemorize
# A comment which can/will be used as a tooltip
Comment=Flash card based learning tool
# The path to the folder in which the executable is run
Path=/opt/jmemorise
# The executable of the application, possibly with arguments.
Exec=jmemorize
# The name of the icon that will be used to display this entry
Icon=jmemorize
# Describes whether this application needs to be run in a terminal or not
Terminal=false
# Describes the categories in which this entry should be shown
Categories=Education;Languages;Java;
```