Metadata-Version: 2.4
Name: dbus_idle
Version: 2026.9.0
Summary: System idle time using DBus
Home-page: https://github.com/bkbilly/dbus_idle
Author-email: Alexander Frenzel <alex@relatedworks.com>, bkbilly <bkbilly@hotmail.com>
Project-URL: Source Code, https://github.com/bkbilly/dbus_idle
Keywords: dbus_idle,dbus-idle
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jeepney>=0.9.0; platform_system != "Windows" and platform_system != "Darwin"
Requires-Dist: pywin32>=221; platform_system == "Windows"
Dynamic: license-file

# dbus-idle

[![pypi](https://img.shields.io/pypi/v/dbus-idle.svg)](https://pypi.python.org/pypi/dbus-idle)
![python version](https://img.shields.io/pypi/pyversions/dbus-idle.svg)
![license](https://img.shields.io/pypi/l/dbus-idle.svg)

Python library to detect user idle time in milliseconds (and from that, inactivity) on Linux, Windows, and macOS.


## Requirements

* Python 3.7 or later
* One of the following:
  * D-Bus with `org.freedesktop.DBus` interface
  * `xprintidle` command
  * libX11 with `XScreenSaverInfo`
  * `swayidle` command
  * Windows
  * macOS


## Installation

Install using:
```
sudo apt install meson libdbus-glib-1-dev patchelf
pip install dbus-idle
```

On non-Linux systems,
```
pip install dbus-idle
```

## Usage

You can use this module from the command line
```bash
dbus-idle
```
or access the current idle time from within your python program
```python
from dbus_idle import IdleMonitor

milliseconds = IdleMonitor().get_dbus_idle()
```

`IdleMonitor.is_idle()` uses a 120-second threshold by default. Both
`idle_threshold` and `get_dbus_idle()` use milliseconds:

```python
monitor = IdleMonitor(idle_threshold=120_000)
```

## Contribution
This is based on the work by [Alexander Frenzel](https://github.com/escaped/idle_time)
