From 9d5460c1c69ffd14350a1016d98a0b1c20e1dd7d Mon Sep 17 00:00:00 2001 From: r1w1s1 Date: Sun, 14 Dec 2025 22:42:29 -0300 Subject: README: clarify stdout output and examples --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index d66734c..2671fdd 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,52 @@ # xnap -xnap is a minimalistic screenshot utility for X. -just `make install` +xnap is a minimal screenshot utility for X11. -you **need** `Xlib` and can use `Xinerama` optionally. -xnap is minimal and just outputs the image contents (PPM format) to the stdout. -please use a tool to collect that info and store / convert it to whatever you like. +It captures screen contents and writes a raw PPM (P6) image to standard +output. xnap does not save files by itself and does not perform image +conversion. -enjoy! +## Building and installing + +make +sudo make install + +## Dependencies + +- Xlib (required) +- Xinerama (optional, for multi-monitor support) + +## Usage + +xnap always writes image data to stdout. Redirect the output to a file or +pipe it to another program for conversion or storage. + +Examples: + +# Select a region and save as PPM +xnap > image.ppm + +# Capture the full screen +xnap -f > fullscreen.ppm + +# Capture screen 0 (Xinerama) +xnap -s 0 > screen0.ppm + +# Convert to PNG using ImageMagick +xnap | convert ppm:- image.png + +## Example key binding + +Using sxwm: + +bind : mod + shift + s : "bash -c 'xnap | pnmtopng | tee ~/Pictures/screenshots/$(date +%Y-%m-%d_%H-%M).png | xclip -selection clipboard -t image/png'" + +## Philosophy + +xnap follows the Unix philosophy: +- do one thing +- do it simply +- leave storage and conversion to other tools + +Enjoy! -> example usage -> sxwm: `bind : mod + shift + s : "bash -c 'xnap | pnmtopng | tee ~/Pictures/screenshots/$(date +%Y-%m-%d_%H-%M).png | xclip -selection clipboard -t image/png'"` -- cgit v1.2.3