#!/bin/bash set -o pipefail options=$"display upload save gimp" #maim -s -u | tee "$HOME/screenshots/latest.png" | xclip -selection clipboard -t image/png grim -g "$(slurp)" - | tee "$HOME/screenshots/latest.png" | wl-copy -t image/png exit_code=$? if [[ $exit_code -eq 0 ]]; then while :; do choice="$(printf %s "$options" | wofi -S dmenu -p "Screenshot options:")" if [ "$choice" = "display" ]; then ( imv "$HOME/screenshots/latest.png" & ) elif [ "$choice" = "upload" ]; then fupload-notify "$HOME/screenshots/latest.png" elif [ "$choice" = "save" ]; then timestamp="$(date +"%Y-%m-%dT%H.%M.%S")" cp "$HOME/screenshots/latest.png" "$HOME/screenshots/$timestamp.png" elif [ "$choice" = "gimp" ]; then ( gimp "$HOME/screenshots/latest.png" & ) else exit 0 fi done else notify-send "Screenshot canceled" exit 1 fi