Crates.io | user-idle |
lib.rs | user-idle |
version | 0.6.0 |
source | src |
created_at | 2020-02-01 19:26:49.137994 |
updated_at | 2023-10-18 20:10:53.986908 |
description | Get a users idle time. |
homepage | https://github.com/olback/user-idle-rs |
repository | https://github.com/olback/user-idle-rs |
max_upload_size | |
id | 203996 |
size | 13,805 |
OS | Supported |
---|---|
Linux (x11) | ✔️ |
Linux (dbus) | ✔️* |
Linux (wayland) | ❌ |
Windows | ✔️ |
MacOS | ✔️ |
* 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 enabling dbus
.
use user_idle::UserIdle;
let idle = UserIdle::get_time().unwrap();
let idle_seconds = idle.as_seconds();
let idle_minutes = idle.as_minutes();
Check the documentation for more methods