> For the complete documentation index, see [llms.txt](https://docs.pkgforge.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pkgforge.dev/sbuild/specification/9.desktop.md).

# 9.Desktop

{% code overflow="wrap" %}

```yaml
#Example ONLY
desktop:
 #Can contain one of (or all of): url, file, dir
 #If it contains multiple (or all), the builder WILL STOP UPON FIRST successful desktop file MATCH
  url: "#A Direct RAW URL to download a .desktop file"
  file: "#A Direct PATH to a .desktop file from ${SBUILD_OUTDIR} | ${SBUILD_TMPDIR}"
  dir: "#A Direct PATH to a Directory that contains at least 1 .Desktop"
```

{% endcode %}

* [x] This is Optional & can be left empty or removed completely (**TYPE**:<mark style="color:blue;">**`NON_ENFORCED`**</mark>)
* [x] This is applicable only if <mark style="color:purple;">**`$pkg_type`**</mark> is a portable format like [**AppImage**](/formats/packages/appimage.md), [**FlatImage**](/formats/packages/flatimage.md) etc
* [x] This will be downloaded/copied & saved as <mark style="color:purple;">**`${SBUILD_PKG}.desktop`**</mark> inside as <mark style="color:orange;">**`${SBUILD_OUTDIR}/${SBUILD_PKG}.desktop`**</mark>
* [x] If used, it can only contain (One of these or all):

> - [x] <mark style="color:purple;">**`url`**</mark> : Is always preferred as the <mark style="color:orange;">**1st Choice**</mark>, even if used with others
> - [x] <mark style="color:purple;">**`file`**</mark> : Is ONLY preferred, if <mark style="color:purple;">**`url`**</mark> was **non-existent/empty**, as the <mark style="color:orange;">**2nd Choice**</mark>
> - [x] <mark style="color:purple;">**`dir`**</mark> : Is ONLY preferred, if both <mark style="color:purple;">**`url`**</mark> & <mark style="color:purple;">**`file`**</mark> are **non-existent/empty**, as the <mark style="color:orange;">**3rd & Final Choice**</mark>

{% code overflow="wrap" %}

```yaml
#Another Example
desktop:
 #Can contain one of (or all of): url, file, dir
  url: "https://example.com/example.desktop"
  #If you only use `/example.desktop` or `example.desktop`, it is assumed as: ${SBUILD_OUTDIR}/example.desktop
  #Here, we specify explictly to use ${SBUILD_TMPDIR}
  file: "${SBUILD_TMPDIR}/example.desktop" 
  #You can just use `/usr/share` or `usr/share`, it is assumed as: ${SBUILD_OUTDIR}/usr/share
  dir: "usr/share" #will search in ${SBUILD_OUTDIR}/usr/share
```

{% endcode %}

{% hint style="info" %} <mark style="color:purple;">**`file`**</mark> supports wildcard glob (<mark style="color:orange;">**`*`**</mark>) pattern

{% code overflow="wrap" %}

```yaml
desktop:
#Will search for a *.desktop file in ${SBUILD_TMPDIR} (picks first match)
  file: "${SBUILD_TMPDIR}/*.desktop"
```

{% endcode %}
{% endhint %}

{% hint style="info" %} <mark style="color:purple;">**`dir`**</mark> supports wildcard glob (<mark style="color:orange;">**`*`**</mark>) pattern

<pre class="language-yaml"><code class="lang-yaml">desktop:
  dir: "${SBUILD_OUTDIR}/usr/share/applications/assets*" 
#Will search inside all these dir (picks first match):
<strong># ${SBUILD_OUTDIR}/usr/share/applications/assets-extras
</strong><strong># ${SBUILD_OUTDIR}/usr/share/applications/assets_res
</strong># ${SBUILD_OUTDIR}/usr/share/applications/assetsXYZ
</code></pre>

{% endhint %}

{% hint style="info" %}
**This MAY BE OVERWRITTEN**, if <mark style="color:purple;">**`x_exec.run`**</mark> *does something to the file*, otherwise is used as **the default&#x20;**<mark style="color:purple;">**`.Desktop`**</mark> file
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pkgforge.dev/sbuild/specification/9.desktop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
