# psleep — sleep with a progress bar [![CI](https://github.com/Yesh-02/psleep/actions/workflows/ci.yml/badge.svg)](https://github.com/Yesh-02/psleep/actions/workflows/ci.yml) [![Release](https://github.com/Yesh-02/psleep/actions/workflows/release.yml/badge.svg)](https://github.com/Yesh-02/psleep/actions/workflows/release.yml) [![Crates.io](https://img.shields.io/crates/v/psleep)](https://crates.io/crates/psleep) [![Cargo Downloads](https://img.shields.io/crates/d/psleep?label=cargo%20downloads)](https://crates.io/crates/psleep) [![GitHub Downloads](https://img.shields.io/github/downloads/Yesh-02/psleep/total?label=github%20downloads)](https://github.com/Yesh-02/psleep/releases) [![License](https://img.shields.io/crates/l/psleep)](LICENSE) A tiny, fast CLI utility written in Rust that works just like `sleep` but shows a live progress bar. Supports human-friendly durations (`psleep 1m30s`), multiple animation styles, and is configurable via flags or environment variables. Never stare at a blank terminal wondering "is this thing still going?" again. ![psleep demo](demo/demo.gif) ## Platform Support | Platform | Architecture | Tested | Binary | |----------|-------------|--------|--------| | Linux | x86_64 | CI | .tar.gz | | Linux | aarch64 | - | .tar.gz | | macOS | x86_64 | CI | .tar.gz | | macOS | aarch64 | CI | .tar.gz | | Windows | x86_64 | CI | .zip | Pre-built binaries are attached to each [GitHub Release](https://github.com/Yesh-02/psleep/releases). ## Install ```bash # Homebrew (macOS) brew install Yesh-02/tap/psleep # From crates.io cargo install psleep # From source cargo install --git https://github.com/Yesh-02/psleep.git # Or download a pre-built binary from Releases ``` ## Usage ```bash # Basic — sleep 10 seconds with a progress bar # (uses native OSC 9;4 if your terminal supports it, otherwise falls back to in-terminal bar) psleep 10 # Human-friendly durations psleep 1m30s psleep 2h5m psleep 0.5 # Force a specific in-terminal style (overrides OSC 9;4) psleep 30 --style bar # ━━━━━━━━━╸━━━━━━━━━━ psleep 30 --style blocks # ████████▓░░░░░░░░░░░ psleep 30 --style dots # ⣿⣿⣿⣿⣿⣦⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀ psleep 30 --style emoji # 🟩🟩🟩🟩🟨⬜⬜⬜⬜⬜⬜⬜ psleep 30 --style classic # #####>-------------- psleep 30 --style spinner # ⠹ 00:00:12 sleeping... (18s remaining) # Short flag psleep 30 -s dots # Custom indicatif template (advanced, forces in-terminal rendering) psleep 60 --template "{elapsed} [{wide_bar}] {percent}%" # Disable native OSC 9;4 (always use in-terminal bar) psleep 30 --no-osc # Adjust tick rate (smoother animation) psleep 10 --tick-ms 50 ``` ## Native Terminal Progress (OSC 9;4) When your terminal supports it, `psleep` uses native progress reporting — progress shows in your tab bar, taskbar, or title. This is the default and requires no configuration. ![OSC 9;4 progress in Ghostty](demo/demo-osc.gif) **Supported terminals:** Windows Terminal, iTerm2, WezTerm, Kitty, Ghostty, VS Code terminal, ConEmu, Contour, foot, Rio. To force in-terminal rendering instead, pass `--style` or `--no-osc`. ## Environment Variables Set defaults without passing flags every time: ```bash export PSLEEP_STYLE=blocks # forces in-terminal style (disables OSC) export PSLEEP_TICK_MS=50 export PSLEEP_TEMPLATE="{elapsed} [{wide_bar}] {eta}" export PSLEEP_NO_OSC=1 # disable native terminal progress ``` Flags always override environment variables. ## Duration Format | Input | Duration | |----------|------------------| | `10` | 10 seconds | | `0.5` | 500 milliseconds | | `1m30s` | 1 min 30 sec | | `2h5m` | 2 hrs 5 min | | `1h2m3s` | 1 hr 2 min 3 sec | ## Use in Scripts `psleep` clears the progress bar on completion, so it works cleanly in pipelines: ```bash echo "Deploying..." && psleep 30 && ./deploy.sh psleep 5m && notify-send "Break's over!" ``` ## TODO - [x] Publish to crates.io — enable `cargo install psleep` - [x] CI/CD pipeline — build/test on Linux, macOS, Windows + auto-release on tag - [x] Native terminal progress bar support (OSC 9;4) — detect capable terminals (Windows Terminal, iTerm2, WezTerm, Kitty) and use native progress reporting as the default, falling back to indicatif rendering - [ ] Sub-millisecond precision — use high-resolution timers to beat standard `sleep` accuracy - [ ] Dynamic terminal resize — handle `SIGWINCH` and redraw the progress bar on terminal width changes - [ ] Quiet mode (`--quiet` / `-q`) — sleep without any output, behaves exactly like `sleep` - [ ] Countdown display mode — show remaining time as `HH:MM:SS` instead of a bar - [ ] Color configuration — allow custom colors via `--color` or `PSLEEP_COLOR` - [ ] Notification on completion — optional system notification (`--notify`) when sleep finishes - [ ] Soundtrack / audio — play a sound during sleep or on completion (`--sound`, `--bell`) - [ ] Multiple durations — support `psleep 1m 30s` (separate args summed, like GNU sleep) - [ ] Signal handling — graceful exit on `SIGINT`/`SIGTERM`, print elapsed time - [ ] Shell completions — generate completions for bash/zsh/fish via `--completions` - [ ] Config file — `~/.config/psleep/config.toml` for persistent defaults - [ ] Progress bar as a library — expose a `ProgressSleep` struct for use in other Rust programs - [ ] Nix package — publish to nixpkgs or provide a flake - [ ] AUR package — publish to Arch User Repository - [ ] Scoop/Winget — Windows package managers - [ ] Debian/RPM packages — `.deb` and `.rpm` for apt/dnf - [ ] Download analytics — unified tracking across all distribution channels ## License Apache-2.0