1
1
Fork 0
nixos/options/custom/scripts/screenshot.sh
Myned 53c8575116
git: migrate to forgejo
Squashes 1,331 commits

Signed-off-by: Myned <dev@bjork.tech>
2024-09-12 19:41:21 -05:00

23 lines
760 B
Bash

#! /usr/bin/env bash
# Screenshot region or display with rounded corners
r=20 # Radius
function round() {
magick - \
\( +clone -alpha extract -draw "fill black polygon 0,0 0,$r $r,0 fill white circle $r,$r $r,0" \
\( +clone -flip \) -compose Multiply -composite \
\( +clone -flop \) -compose Multiply -composite \) \
-alpha off -compose CopyOpacity -composite -
}
# TODO: Use proper flags
# TODO: Add clipboard support
if [[ "${1-}" == '-e' ]]; then
grimblast --freeze save area - | round | swappy --file -
elif [[ "${1-}" == '-d' ]]; then
grimblast --freeze save output - | round > "$XDG_SCREENSHOTS_DIR/$(date +'%F %H.%M.%S').png"
else
grimblast --freeze save area - | round > "$XDG_SCREENSHOTS_DIR/$(date +'%F %H.%M.%S').png"
fi