This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/common/bin/clipshot

30 lines
615 B
Plaintext
Raw Permalink Normal View History

2019-05-08 13:31:23 -05:00
#!/usr/bin/env bash
set -x
umask 077
d="$(date +"%Y-%m-%d_%H-%M-%S")"
fn="$SCROTS_PATH/clipshot_$d.png"
2021-05-10 13:29:39 -05:00
mkdir -p "$SCROTS_PATH"
2023-05-10 16:58:57 -05:00
dim="$(slurp -d -b \#00000066 -c \#ffffffff)"
if [ "$?" -eq 0 ]; then
grim -g "$dim" - | wl-copy -t image/png
wl-paste -n > "$fn"
echo "$fn"
2023-05-10 16:58:57 -05:00
else
exit 1
2020-03-24 14:11:38 -05:00
fi
2023-05-10 16:58:57 -05:00
2023-07-17 11:23:37 -05:00
# TODO: implement for X and other OSs?
2023-05-10 16:58:57 -05:00
# pkill unclutter
# sleep 0.1
# import "$fn"
# < "$fn" xclip -t image/png -i -selection clipboard
# < "$fn" xclip -t image/png -i -selection primary
# < "$fn" xclip -t image/png -i -selection secondary
# < "$fn" xclip -t image/png -i -selection buffer-cut
# unclutter &
# echo "$fn"