Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍺 chpop

The last round before you close the terminal.

License: MIT Rust CI/CD Platforms


You typed exit. The session is over. But before the cursor blinks its last blink, chpop pops the cap off a cold ASCII beer, lets the foam rise, and sends you off with a satisfying psst! / pop!

Every goodbye deserves a toast. One last animation. One last sip. Then you're free to go.


✨ How It Works

flowchart LR
    A["`πŸ‘€ You type
    exit`"]
    --> B["`🍺 chpop intercepts
    via shell hook`"]
    --> C["`πŸ’¨ Foam & fizz!
    ~2 s animation`"]
    --> D["`πŸ‘‹ Real exit runs
    session ends`"]
Loading
Step What happens
Intercepts A shell function overrides exit, checks if chpop is installed, and calls it first.
Pops The terminal enters the alternate screen, hides the cursor, and plays a short ASCII beer-bottle-opening animation (~2 s). Frames are embedded in the binary at compile time.
Fizz Foam rises, gas escapes β€” then the terminal is restored cleanly.
Exits The real built-in exit runs with your original arguments (exit code included).

⏩ Quick Exit

Press q, Esc, or Ctrl+C to skip the animation if you're in a real rush. The terminal is always restored cleanly β€” even on panic β€” thanks to RAII guards with a libc::tcsetattr safety net.


πŸ“¦ Install

From Source

cargo build --release
ln -s "$(pwd)/target/release/chpop" ~/.local/bin/chpop

Pre-built Packages (GitHub Releases)

Download the latest package for your platform from the Releases page:

Package Platform
.deb Debian / Ubuntu
.rpm Fedora / RHEL
.pkg.tar.zst Arch Linux
.tar.gz macOS (x86_64 & Apple Silicon)

Debian / Ubuntu (.deb)

sudo dpkg -i chpop_*.deb
# or if dependencies are missing:
sudo apt-get install -f

Fedora / RHEL / openSUSE (.rpm)

sudo rpm -i chpop-*.rpm

Arch Linux (.pkg.tar.zst)

sudo pacman -U chpop-*.pkg.tar.zst

macOS (.tar.gz)

tar xzf chpop-*-macos-*.tar.gz
mv chpop /usr/local/bin/   # or ~/.local/bin/

Note: macOS Gatekeeper may block unsigned binaries. If prompted, go to System Settings β†’ Privacy & Security and click Allow Anyway.


πŸ”Œ Shell Integration (exit hook)

Bash

Add to ~/.bashrc:

# chpop: beer animation on terminal exit
exit() {
    if command -v chpop >/dev/null 2>&1; then
        chpop
    fi
    builtin exit "$@"
}

Zsh

Add to ~/.zshrc:

# chpop: beer animation on terminal exit
exit() {
    if command -v chpop >/dev/null 2>&1; then
        chpop
    fi
    builtin exit "$@"
}

How it works

  • The exit function overrides the shell's built-in command.
  • Before ending the session, chpop is invoked.
  • builtin exit calls the real built-in exit, forwarding all arguments (e.g. the exit code in exit 0).
  • If chpop is not installed (command -v fails to find the binary), the step is skipped β€” nothing breaks.

πŸ”¨ Build

Make sure you have Rust and Cargo installed, then:

cargo build --release

The build script (build.rs) auto-discovers assets/*/anim.json files and compiles all frame data into the binary. No manual configuration needed.


🎬 Adding New Animations

  1. Create a directory assets/<name>/
  2. Add an anim.json file:
    { "name": "<name>", "fps_ms": 400 }
  3. Add frame files frame_000.txt, frame_001.txt, …
  4. cargo build β€” the animation is picked up automatically

πŸ“‚ Project Structure

chpop/
β”œβ”€β”€ Cargo.toml           ─ runtime + build dependencies
β”œβ”€β”€ build.rs             ─ auto-discovers assets/*/anim.json, generates frame arrays
β”œβ”€β”€ assets/
β”‚   └── chpop/
β”‚       β”œβ”€β”€ anim.json    ─ auto-generated metadata
β”‚       └── frame_*.txt  ─ ASCII art frames
└── src/
    β”œβ”€β”€ main.rs          ─ entry point, SIGINT handler, animation launch
    β”œβ”€β”€ terminal.rs      ─ TerminalGuard (RAII alternate screen + raw mode + safety net)
    └── animation.rs     ─ frame rendering, centring, early-exit support

β˜• Support & Donations

If chpop made your last terminal seconds a little more fun, consider throwing some crypto-dust to keep the fridge stocked. Every satoshi, gwei, and piconero buys another round!

Coin Network Address
Monero XMR 89tK9E9LbwdCsnnZGFMJzU7yBRGaQ7hfPTeNXWCe2LW3G7kCkJWswhb2ieBkHFrBs2JfdsmumQ3nY9obQ6fxb4HzHpTjCjd
Bitcoin BTC bc1qh0t2u7d7u0pl2yzmxuq80verhlfxuj0r29lfv7
USDT Polygon 0xe1aAE089F1b0A3b2649017A7E7afa720877409C8
USDC Polygon 0xe1aAE089F1b0A3b2649017A7E7afa720877409C8
USDT TRON TMkxXPuxamSci19rSygy58QRjZ9vmLjqtu
Ethereum Arbitrum 0xe1aAE089F1b0A3b2649017A7E7afa720877409C8

About

chpop 🍺 β€” Because quitting your terminal deserves a celebration.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages