user-idle2

Crates.iouser-idle2
lib.rsuser-idle2
version0.6.2
created_at2025-05-25 14:19:12.878442+00
updated_at2025-05-28 19:05:16.453446+00
descriptionGet a user's idle time.
homepage
repository
max_upload_size
id1688397
size21,011
Pieter (pieterdd)

documentation

README

user-idle2

This is a fork of user-idle-rs, which had been idle for a while and did not support Wayland.

OS Supported
Linux ✔️*
Windows ✔️
MacOS ✔️

* The Linux implementation will do the following:

  1. Try to get the idle time from Mutter via DBus. This should work on GNOME desktops with Wayland or X11.
  2. Try to get the idle time from X11. This will not work on Wayland.
  3. As a last resort, try to get the screensaver's idle time via DBus. Note that the screensaver may report a value of 0ns when it's not active.

Example

use user_idle2::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.

Commit count: 0

cargo fmt