https://github.com/olback/user-idle-rs
Get a users idle time
https://github.com/olback/user-idle-rs
desktop hacktoberfest linux macos rust users-idle windows
Last synced: 9 months ago
JSON representation
Get a users idle time
- Host: GitHub
- URL: https://github.com/olback/user-idle-rs
- Owner: olback
- Created: 2020-02-01T19:10:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-26T00:51:40.000Z (about 2 years ago)
- Last Synced: 2024-08-09T05:42:15.106Z (over 1 year ago)
- Topics: desktop, hacktoberfest, linux, macos, rust, users-idle, windows
- Language: Rust
- Homepage: https://crates.io/crates/user-idle
- Size: 44.9 KB
- Stars: 17
- Watchers: 2
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```rust
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](https://docs.rs/user-idle/latest/user_idle/) for more methods