loading...

re: How do you take screenshots? VIEW POST

FULL DISCUSSION
 

I wrote a script to launch maim, and use a series of dmenu prompts to give me the option to save, edit, and upload the image

#!/bin/bash

# Glorious screenshot script
# Expects dmenu, maim, pinta, xclip, and imgup(gitlab.com/jcgollnick/imgup-rs.git)

image="$(mktemp /tmp/screenshot.XXXXXXX)"
trap "[ -f $image ] && rm $image" 0 1 2 15

maim -sBulc 0.0,0.0,0.5,0.2 -f png | tee $image | xclip -selection clipboard -t image/png

defaultimg="$(date +%Y_%V-%w-%H%M%S).png"
custfilenm=$(echo $defaultimg | dmenu -p "Save as?")
[ -z "$custfilenm" ] && exit

[ -d "$HOME/pictures/screenshots" ] || mkdir -p "$HOME/pictures/screenshots"
savefile="$HOME/pictures/screenshots/$custfilenm"
mv $image $savefile
notify-send -u low "Image saved" "$savefile"

[ $(printf "yes\nno" | dmenu -i -p "Edit $custfilenm?") == "yes" ] && pinta $savefile
xclip -selection clipboard -t image/png < $savefile

[ $(printf "yes\nno" | dmenu -i -p "Upload $custfilenm?") == "yes" ] || exit
notify-send -u low "Uploading $custfilenm..."
deets=$(imgup $savefile | paste -d'&' -s)
echo ${deets%%&*} | xclip -selection clipboard -r
notify-send -t 20000 "Screenshot uploaded" "${deets%%&*}\n${deets##*&}"
code of conduct - report abuse