47 lines
740 B
Plaintext
Executable File
47 lines
740 B
Plaintext
Executable File
notify-send "Postion 1"
|
|
sleep 2
|
|
eval $(xdotool getmouselocation --shell)
|
|
X1=$X
|
|
Y1=$Y
|
|
|
|
notify-send "Postion 2"
|
|
sleep 2
|
|
|
|
eval $(xdotool getmouselocation --shell)
|
|
X2=$X
|
|
Y2=$Y
|
|
|
|
# X COORDS
|
|
if [[ $X2 -ge $X1 ]]; then
|
|
X=$X1
|
|
W=$(($X2-$X1))
|
|
else
|
|
X=$X2
|
|
W=$(($X1-$X2))
|
|
fi
|
|
|
|
# Y COORDS
|
|
if [[ $Y2 -ge $Y1 ]]; then
|
|
Y=$Y1
|
|
H=$(($Y2-$Y1))
|
|
else
|
|
Y=$Y2
|
|
H=$(($Y1-$Y2))
|
|
fi
|
|
|
|
CLIPBOARD="0"
|
|
DISK="1"
|
|
SAVE=$(notify-send "How to save?" --action=$CLIPBOARD=Clipboard --action=$DISK=Disk --expire-time=99999)
|
|
|
|
if [[ $SAVE == $CLIPBOARD ]]; then
|
|
shotgun - | xclip -selection clipboard -target image/png -i
|
|
elif [[ $SAVE == $DISK ]]; then
|
|
shotgun -g ${W}x${H}+${X}+${Y} ~/Pictures/$(date +%a%b%d-%G-%s).png
|
|
else
|
|
# They let the notification expire
|
|
echo 0
|
|
fi
|
|
|
|
|
|
|