https://github.com/metaory/drastic-idle
detect system idleness and start taking phases of drastic measures
https://github.com/metaory/drastic-idle
Last synced: 2 months ago
JSON representation
detect system idleness and start taking phases of drastic measures
- Host: GitHub
- URL: https://github.com/metaory/drastic-idle
- Owner: metaory
- License: mit
- Created: 2026-02-07T15:44:08.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2026-02-15T13:29:38.000Z (4 months ago)
- Last Synced: 2026-02-15T20:17:02.052Z (4 months ago)
- Language: Rust
- Size: 37.1 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# drastic-idle
TUI that tracks idle time and runs phased actions: after phase1 (optional command + close focused window on X11), after phase2 (power off). Defaults: phase1 = 10s idle, phase2 = 5m countdown then `systemctl poweroff`. Optional args: `[phase1_secs] [phase2_secs]` override the timer seconds.
- **Phase 1**: idle ≥ 10s → close the window that had focus (X11 only), run optional phase1 command (none by default); then phase 2 starts.
- **Phase 2**: 5m countdown → `systemctl poweroff` then exit.
## Support
| Feature | X11 | Wayland |
|--------|-----|---------|
| **System-wide idle** | ✓ (X11 backend) | ✓ on GNOME (Mutter/DBus via user-idle2) |
| **Phase 1: close focused window** | ✓ (needs `xdotool`) | ✗ |
**Why no “close window” on Wayland:** That behavior uses `xdotool` (get active window, then close it). Wayland has no equivalent: the protocol does not let one app query or control other apps’ windows for security. So on Wayland the app still runs (idle + phase2 countdown work), but phase1 does not close any window.
If no system idle backend is available, idle is TUI-only (only input in the app resets the timer).
## Requirements
- **Build:** Rust (e.g. Arch: `rust`).
- **Run:** Terminal with alt-screen and mouse. Optional: `xdotool` for phase1 “close window” on X11. Poweroff may need polkit or root.
## Build & install
```bash
make # → target/release/drastic-idle
make install # → $(PREFIX)/bin (default /usr/local/bin)
```
Or `cargo build --release`.
## Usage
```bash
./drastic-idle [phase1_secs] [phase2_secs]
```
- No args: phase1=10s, phase2=300s.
- One arg: phase1 set, phase2=300s (e.g. `./drastic-idle 30`).
- Two args: phase1 and phase2 (e.g. `./drastic-idle 30 600`). Invalid/missing args fall back to defaults.
- **q** or **Ctrl+c** — quit.
- Idle is shown with ms; any key/mouse **system-wide** (when system idle is used) resets it.
Phase 1 on X11: the window that had focus when you went idle is closed (via `xdotool`). No extra phase1 command by default.
## License
[MIT](LICENSE)