Skip to content

Yesh-02/psleep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

psleep — sleep with a progress bar

CI Release Crates.io Cargo Downloads GitHub Downloads 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

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.

Install

# 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

# 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

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:

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:

echo "Deploying..." && psleep 30 && ./deploy.sh
psleep 5m && notify-send "Break's over!"

TODO

  • Publish to crates.io — enable cargo install psleep
  • CI/CD pipeline — build/test on Linux, macOS, Windows + auto-release on tag
  • 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

About

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 (bar, spinner, dots, blocks), and is configurable via flags or environment variables. Never stare at a blank terminal wondering "is this thing still going?" again.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages