-
Notifications
You must be signed in to change notification settings - Fork 0
igorlogius/scr2ppm
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
#!/bin/bash
# (SCR)een (to) (P)ortable (P)ix(M)ap - (SCR2PPM)
The tiniest X11 screen capture aka. screenshot utility
# Install from flathub
```
$ flatpak install io.github.igorlogius.scr2ppm
```
# Run via flatpak from CLI
```
$ flatpak run io.github.igorlogius.scr2ppm [ARGS]
```
# ARGumentS
one of `-s`,`-a` or `-w` is required and `-d` can be optionally added to add a delay before the capture
```
-s := capture the entire screen area
-a := capture a custom area
-w := capture a window
-d := add a delay in seconds (optional)
```
# Output
The output will be send to STDOUT (STanDard OUTput) and can be written to a Portable PixMap (PPM) file
or directly piped into another programm like (image/gaphickmagics `convert`) to process it further
# Examples
```
scr2ppm -s > shot.ppm // screenshot entire screen immediately
scr2ppm -s | convert - shot.png // make screenshot and save it via convert as a png
scr2ppm -s -d 10 // screenshot entire screen after 10 seconds
scr2ppm -a // screenshot selected area immediately
scr2ppm -w -d 5 // screenshot window (select with mouse) after 5 seconds
scr2ppm -a -d 3 // screenshot custom area after 3 seconds
```
# Manual build script
CWD=$PWD
MISSING_REQ=0
for req in mktemp wget unzip;do
type $req >/dev/null 2>&1 || { echo >&2 "Missing dependency: $req"; MISSING_REQ=1; }
done
[ $MISSING_REQ -ne 0 ] && { echo "Aborting because of missing dependency"; exit 1; }
ZIPFILE=$(mktemp)
EXTRDIR=$(mktemp -d)
wget -q --show-progress https://github.com/igorlogius/src2ppm/archive/main.zip -O $ZIPFILE
unzip -j $ZIPFILE "src2ppm-main/scr2ppm.c" -d $EXTRDIR
unzip -j $ZIPFILE "src2ppm-main/CMakeLists.txt" -d $EXTRDIR
cd $EXTRDIR
type cmake >/dev/null 2>&1;CM_RET=$?
type cc >/dev/null 2>&1;CC_RET=$?
if [ $CM_RET -eq 0 ];then
cmake . && make
elif [ $CC_RET -eq 0];then
cc ./scr2ppm.c -lX11 -lxcb -lXau -lXdmcp -o scr2ppm
fi
if [ -x ./scr2ppm ];then
mv scr2ppm $CWD/;
echo "build done"
else
echo "build failed";
fi
rm -rf $EXTRDIR/ $ZIPFILE
# EOF
About
The tiniest X11 screen capture aka. screenshot utility