Crates.io | user-idle-time |
lib.rs | user-idle-time |
version | 0.7.0 |
created_at | 2025-03-27 09:52:25.734121+00 |
updated_at | 2025-03-27 15:57:59.299288+00 |
description | Get a user's idle time. |
homepage | https://github.com/BenjaminBrienen/user-idle-time |
repository | https://github.com/BenjaminBrienen/user-idle-time |
max_upload_size | |
id | 1607776 |
size | 73,856 |
user-idle-time
Get the idle time of a user
OS | Supported |
---|---|
Linux (x11) | ✔️ |
Linux (dbus) | ✔️* |
Linux (wayland) | ❌ |
Windows | ✔️ |
MacOS | ❌ |
[!NOTE] DBus returns the time the session has been locked, not the time since the last user input event.
By default, x11 is used on Linux. DBus can be enabled in
Cargo.toml
by disabling default-features and enablingdbus
.
use user_idle_time::get_idle_time;
let idle = get_idle_time().unwrap();
let idle_seconds = idle.as_secs();
Check the documentation for more methods.