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:
- Try to get the idle time from Mutter via DBus. This should work on GNOME desktops with Wayland or X11.
- Try to get the idle time from X11. This will not work on Wayland.
- 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 UserIdle;
let idle = get_time.unwrap;
let idle_seconds = idle.as_seconds;
let idle_minutes = idle.as_minutes;
Check the documentation for more methods.