2 unstable releases

Uses new Rust 2024

0.7.0 Mar 27, 2025
0.6.0 Mar 27, 2025

#212 in Date and time

Download history 189/week @ 2025-03-22 56/week @ 2025-03-29 5/week @ 2025-04-05

250 downloads per month

MIT/Apache

22KB
243 lines

Get the idle time of a user. The time returned is the time since the last user input event.

Example:

use user_idle_time::get_idle_time;
let idle = get_idle_time().unwrap();
let idle_seconds = idle.as_secs();

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 enabling dbus.

Example

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.

Dependencies

~0.1–9MB
~73K SLoC