neodotfiles/user/.config/suckless/dmenu/scripts/dmenu_scrot

67 lines
2.4 KiB
Text
Raw Normal View History

2022-12-20 00:15:21 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple screenshot dmenu script
2023-06-24 17:00:22 +00:00
# - Dependencies: escrotum, dmenu, notify-send
2022-12-20 00:15:21 +00:00
## CREATING SCREENSHOT FOLDER ##
2023-06-24 17:00:22 +00:00
mkdir -p "$HOME/Media/Pictures/Screenshots"
cd "$HOME/Media/Pictures/Screenshots" || exit 0
2022-12-20 00:15:21 +00:00
## CHOICES ##
2023-06-24 17:00:22 +00:00
cho1="󱣴 Entire screen"
2023-08-04 13:16:09 +00:00
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"
2022-12-20 00:15:21 +00:00
## DELAY OPTIONS ##
2023-06-24 17:00:22 +00:00
del1="󱑀 3 sec delay"
del2="󱑂 5 sec delay"
del3="󱑇 10 sec delay"
2022-12-20 00:15:21 +00:00
dels="$del1\n$del2\n$del3"
2023-05-23 23:54:34 +00:00
## MAIN ACTION ##
2023-08-04 13:16:09 +00:00
choice=$(echo -e "$chos" | dmenu -i -l 9 -p " Sreenshot Menu")
2023-05-23 23:54:34 +00:00
case $choice in
2023-06-24 17:00:22 +00:00
"$cho1")
2023-08-04 13:16:09 +00:00
maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
2023-06-24 17:00:22 +00:00
"$cho2")
2023-08-04 13:16:09 +00:00
maim | xclip -selection clipboard -t image/png && notify-send "Screenshot saved to clipboard";;
"$cho3")
2023-06-24 17:00:22 +00:00
del=$(echo -e "$dels" | dmenu -i -p " Select Delay");
case $del in
"$del1")
2023-08-04 13:16:09 +00:00
sleep 3 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
2023-06-24 17:00:22 +00:00
"$del2")
2023-08-04 13:16:09 +00:00
sleep 5 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved";;
2023-06-24 17:00:22 +00:00
"$del3")
2023-08-04 13:16:09 +00:00
sleep 10 && maim -f jpg $(date +%s).jpg && notify-send "Screenshot saved"
2023-06-24 17:00:22 +00:00
esac ;;
"$cho4")
2023-08-04 13:16:09 +00:00
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")
2023-06-24 17:00:22 +00:00
exit 0
2022-12-20 00:15:21 +00:00
esac