# Building an activity monitor

Your application can monitor user activity by tracking system idle time and detecting which application is currently in focus.

The [System - Idle Time](/deskifier/deskifier-bubble.io-docs/system-element/states.md#system-idle-time) state provides the amount of time the system has been inactive, allowing your application to determine whether the user is actively using their device or has stepped away. \
\
In addition, the [Applications Element](/deskifier/deskifier-bubble.io-docs/applications-element.md) can be used to read information about running applications, including which one is currently focused.

By combining these two sources of information, you can build an activity monitor that detects user presence, tracks active applications, or logs periods of inactivity. This can be useful for productivity tracking, automation workflows, or applications that need to respond when a user becomes idle.

***

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

{% hint style="success" %}
View this example in the editor:\
\
<https://bubble.io/page?id=deskifier-plugin-test&tab=Design&name=activity-monitor-example&type=page&elements=bTQpb>
{% endhint %}


---

# 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/building-an-activity-monitor.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.
