This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/screenshotsh

39 lines
808 B
Bash
Executable File

#!/bin/sh
if which xdg-user-dir &> /dev/null
then
DESTFOLDER=$(xdg-user-dir PICTURES)
else
for i in Images Imagens Pictures Fotos ""
do
DESTFOLDER=$HOME/$i
test -d "$DESTFOLDER" &&
break
done
mkdir -p $DESTFOLDER
fi
DESTFILE=$DESTFOLDER/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')
case $1 in
def)
# Screenshot to file
grim $DESTFILE
echo $DESTFILE
;;
area)
# Screen area to file
grim -g "$(slurp)" $DESTFILE
echo $DESTFILE
;;
area-clip)
# Screen area to clipboard
grim -g "$(slurp)" - | wl-copy
;;
clip)
# Focused monitor to clipboard
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy
;;
esac