29 lines
653 B
Bash
Executable file
29 lines
653 B
Bash
Executable file
#!/bin/bash
|
|
|
|
timestamp=$(date +%F-%T)
|
|
|
|
picture=$(maim --hidecursor --select /tmp/$timestamp.png)
|
|
|
|
declare -a options=(
|
|
"clipboard"
|
|
"filesave"
|
|
"cancel"
|
|
)
|
|
|
|
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -p 'Clip or Save')
|
|
|
|
if [[ "$choice" == "cancel" ]]; then
|
|
rm /tmp/$timestamp.png
|
|
echo "Canceled." && exit 1
|
|
|
|
elif [ "$choice" == "clipboard" ]; then
|
|
xclip -selection clipboard -target image/png -i /tmp/$timestamp.png
|
|
rm /tmp/$timestamp.png
|
|
echo 'saved to clipboard'
|
|
|
|
elif [ "$choice" == "filesave" ]; then
|
|
mv /tmp/$timestamp.png ~/Pictures/$timestamp.png
|
|
echo 'saved to ~/Pictures/'$timestamp'.png'
|
|
|
|
fi
|