first commit
This commit is contained in:
26
scr
Executable file
26
scr
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! command -v slop >/dev/null; then
|
||||
echo "scr: slop not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
copy=0
|
||||
if [ $# -eq 0 ]; then
|
||||
copy=1
|
||||
out=$(mktemp --suffix=.png)
|
||||
else
|
||||
out=$1
|
||||
fi
|
||||
|
||||
coords=$(slop -f "%x %y %w %h" 2>/dev/null) || exit 1
|
||||
read x y w h <<<"$coords"
|
||||
|
||||
ffmpeg -f x11grab -loglevel error -s ${w}x${h} \
|
||||
-i ${DISPLAY}+${x},${y} -frames:v 1 -y "$out"
|
||||
|
||||
if [ $copy -eq 1 ]; then
|
||||
xclip -selection clipboard -t image/png -i "$out"
|
||||
fi
|
||||
|
||||
echo "$out"
|
||||
Reference in New Issue
Block a user