neodotfiles/user/.config/suckless/dmenu/scripts/dmenu_scrot
Darius Drake 66d7ed48b6 updated
2023-08-04 09:16:09 -04:00

66 lines
2.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple screenshot dmenu script
# - Dependencies: escrotum, dmenu, notify-send
## CREATING SCREENSHOT FOLDER ##
mkdir -p "$HOME/Media/Pictures/Screenshots"
cd "$HOME/Media/Pictures/Screenshots" || exit 0
## CHOICES ##
cho1="󱣴 Entire screen"
cho2="󱣴 Entire screen (Copy to clipboard)"
cho3="󱎫 Entire screen with delay"
cho4="󱎫 Entire screen with delay (Copy to clipboard)"
cho5="󱕻 Select area"
cho6="󱕻 Select area (Copy to clipboard)"
cho7="󰖯 Active window"
cho8="󰖯 Active window (Copy to clipboard)"
cho9="󱎘 Exit"
chos="$cho1\n$cho2\n$cho3\n$cho4\n$cho5\n$cho6\n$cho7\n$cho8\n$cho9"
## DELAY OPTIONS ##
del1="󱑀 3 sec delay"
del2="󱑂 5 sec delay"
del3="󱑇 10 sec delay"
dels="$del1\n$del2\n$del3"
## MAIN ACTION ##
choice=$(echo -e "$chos" | dmenu -i -l 9 -p " Sreenshot Menu")
case $choice in
"$cho1")
maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
"$cho2")
maim | xclip -selection clipboard -t image/png && notify-send "Screenshot saved to clipboard";;
"$cho3")
del=$(echo -e "$dels" | dmenu -i -p " Select Delay");
case $del in
"$del1")
sleep 3 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
"$del2")
sleep 5 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
"$del3")
sleep 10 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved"
esac ;;
"$cho4")
del=$(echo -e "$dels" | dmenu -i -p " Select Delay");
case $del in
"$del1")
sleep 3 && maim | xclip -selection clipboard -t image/png && notify-send "Screenshot saved to clipboard";;
"$del2")
sleep 5 && maim | xclip -selection clipboard -t image/png && notify-send "Screenshot saved to clipboard";;
"$del3")
sleep 10 && maim | xclip -selection clipboard -t image/png && notify-send "Screenshot saved to clipboard"
esac ;;
"$cho5")
maim -s -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
"$cho6")
maim -s | xclip -selection clipboard -t image/png && notify-send "Screenshot saved";;
"$cho7")
maim -i $(xdotool getactivewindow) -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
"$cho8")
maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png && notify-send "Screenshot saved";;
"$cho9")
exit 0
esac