re-add screengrab script
This commit is contained in:
parent
b18beb9aca
commit
85080081bc
1 changed files with 23 additions and 0 deletions
23
bin/screengrab
Executable file
23
bin/screengrab
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
DIR=${XDG_SCREENSHOT_DIR:-$HOME}
|
||||||
|
TARGET="${DIR}/screenshot/grab-$(date +'%Y%m%d%H%M%S').png"
|
||||||
|
|
||||||
|
has() {
|
||||||
|
command -v $1 &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo $1
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
has grim || die "missing grim"
|
||||||
|
has wl-copy || die "missing wl-copy"
|
||||||
|
has slurp || die "missing slurp"
|
||||||
|
|
||||||
|
grim -g "$(slurp)" $TARGET
|
||||||
|
if [ -s $TARGET ]; then
|
||||||
|
wl-copy < $TARGET
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue