alkaa/roles/scripts/files/dmenu_screenshot
2023-05-15 10:20:15 +02:00

15 lines
952 B
Bash

#! /usr/bin/env sh
# Changed a bit from Luke Smith https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/maimpick
# A dmenu for selecting a screenshot option as listed below. Requires maim, xdotool and dmenu.
DEST="/home/max/bilder/screenshots/screenshot_$(date +%Y-%m-%d_%T).png"
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (to clipboard)\\ncurrent window (to clipboard)\\nfull screen (to clipboard)" | dmenu -i -p "Screenshot which area?")" in
"a selected area") maim -u -s $DEST ;;
"current window") maim -u -i "$(xdotool getactivewindow)" $DEST ;;
"full screen") maim -u -B -d '0.8' --quiet $DEST ;;
"a selected area (to clipboard)") maim -s -u | xclip -selection clipboard -t image/png ;;
"current window (to clipboard)") maim -u -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (to clipboard)") maim | xclip -selection clipboard -t image/png ;;
esac