dots-of-war/files/scripts/screenshot.sh

32 lines
883 B
Bash
Raw Normal View History

2020-03-20 15:40:53 +00:00
#!/bin/bash
2020-04-02 07:31:20 +00:00
to_file=0
fullscreen=0
for arg in "$@"; do
case $arg in
--tofile) to_file=1;;
--fullscreen) fullscreen=1;;
esac
done
2020-05-05 16:21:27 +00:00
# Do not quote this, this is multiple flags
2020-05-10 20:27:15 +00:00
select_flag="-s --highlight --color 1,1,1,0.1"
2020-05-05 16:21:27 +00:00
2020-04-02 07:31:20 +00:00
[ $fullscreen -eq 1 ] && select_flag=""
if [ $to_file -eq 1 ]; then
file="$HOME/Bilder/screenshots/screenshot_$(date +%s).png"
echo "$file"
2020-04-19 15:49:39 +00:00
[ -z "$select_flag" ] && sleep 1
2020-04-02 07:31:20 +00:00
maim $select_flag --format png "$file"
echo "$file" | xclip -selection clipboard
else
2020-04-19 15:49:39 +00:00
[ -z "$select_flag" ] && sleep 1
2020-05-05 16:21:27 +00:00
maim $select_flag --format png /dev/stdout | xclip -selection clipboard -t image/png -i
2020-04-02 07:31:20 +00:00
fi
2020-04-21 12:37:47 +00:00
# phisch's ultimate screenshot script. saves to file, uploads to 0x0.st and to clipboard.
# maim -s | tee >(xclip -selection clipboard -t image/png) ~/Pictures/screenshots/$(date +%s).png | curl -F "file=@-" 0x0.st | xclip -selection primary