# Hiding to taskbar / Running in background

When ever your user attempts to close your application, you can instead hide your application and make your app accessible through the system tray.

{% columns %}
{% column width="33.33333333333333%" %}

<div align="left"><figure><img src="/files/bVlxggt8qg5Wsx8gXwZY" alt=""><figcaption></figcaption></figure></div>

{% endcolumn %}

{% column width="66.66666666666667%" valign="middle" %}

<figure><img src="/files/IMcgMBE0VqSSlJME3XD2" alt="" width="231"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

<figure><img src="/files/TdM9gFZiims2EfQClTGZ" alt=""><figcaption></figcaption></figure>

***

### How To:

To accomplish this, we need two things\
\
1\. Control over our browser window with the [Windows Element](/deskifier/deskifier-bubble.io-docs/windows-element.md)\
2\. The ability to manage our system tray with the [Tray Element](/deskifier/deskifier-bubble.io-docs/tray-element.md)

#### Step 1.

Set your window's **Closable** property to "no" with the [Update Window Properties](/deskifier/deskifier-bubble.io-docs/windows-element/actions.md#window-update-window-properties) action.<br>

<figure><img src="/files/xs4oWJYe90w14qCJwIyt" alt=""><figcaption></figcaption></figure>

This will prevent the user from being able to close out of your app.&#x20;

#### Step 2.

Listen for the [Window - Exit Attempted ](/deskifier/deskifier-bubble.io-docs/windows-element/events.md#window-exit-attempted)event.&#x20;

<figure><img src="/files/XKMaAT3TmfBlByIEdZ5l" alt=""><figcaption></figcaption></figure>

When this fires, we'll run the [Window - Hide](/deskifier/deskifier-bubble.io-docs/windows-element/actions.md#window-hide-window) event & update our window properties to "skip" the taskbar.

<figure><img src="/files/olGaOBUfI9WcrU11N2sB" alt=""><figcaption></figcaption></figure>

#### Step 3.

Now we'll create our tray widget. This is so that the user can access our app once it's hidden. In the same event as above, run the [Create Tray](/deskifier/deskifier-bubble.io-docs/tray-element/actions.md#create-tray) action.

<figure><img src="/files/BsQ2ptG4Zn80n6pgrqGf" alt=""><figcaption></figcaption></figure>

#### Step 4.

And finally, we need to give a users a way back into the app from the hidden state. We'll do this by listening for the [Tray Icon Left Clicked](/deskifier/deskifier-bubble.io-docs/tray-element/events.md#tray-icon-left-clicked) event.

<figure><img src="/files/mEGt9LTqgPybcsdZ6oWx" alt=""><figcaption></figcaption></figure>

When this is clicked, we'll update the window properties to set **Skip Taskbar** to no & run the [Window - Show](/deskifier/deskifier-bubble.io-docs/windows-element/actions.md#window-show) action.

<figure><img src="/files/h0hsa1WokeDFEV0HiJLr" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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://deskifier.gitbook.io/deskifier/deskifier-bubble.io-docs/guides-and-examples/hiding-to-taskbar-running-in-background.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.
