11 unstable releases

0.6.0 Oct 18, 2023
0.5.3 Apr 29, 2023
0.5.2 Sep 8, 2022
0.5.1 Jan 26, 2022
0.1.1 Feb 1, 2020

#304 in GUI

Download history 85/week @ 2024-06-17 34/week @ 2024-06-24 70/week @ 2024-07-01 90/week @ 2024-07-08 137/week @ 2024-07-15 403/week @ 2024-07-22 618/week @ 2024-07-29 407/week @ 2024-08-05 222/week @ 2024-08-12 228/week @ 2024-08-19 186/week @ 2024-08-26 256/week @ 2024-09-02 195/week @ 2024-09-09 223/week @ 2024-09-16 215/week @ 2024-09-23 396/week @ 2024-09-30

1,033 downloads per month
Used in 3 crates

MIT/Apache

14KB
275 lines

Get the idle time of a user

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.

Example

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


lib.rs:

Get the idle time of a user

The time returned is the time since the last user input event

See the README.md for more information

Example:

use user_idle::UserIdle;
let idle = UserIdle::get_time().unwrap();
let idle_seconds = idle.as_seconds();
let idle_minutes = idle.as_minutes();

Dependencies

~0–12MB
~86K SLoC