neodotfiles/user/.config/rofi/scripts/rofi_scrot

64 lines
1.4 KiB
Text
Raw Normal View History

2022-09-13 01:06:55 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple screenshot dmenu script
# - Dependencies: scrot, dmenu, notify-send
## CREATING SCREENSHOT FOLDER ##
2023-01-20 18:15:37 +00:00
mkdir -p "$HOME/Pictures/Screenshots"
cd "$HOME/Pictures/Screenshots" || exit 0
2022-09-13 01:06:55 +00:00
## CHOICES ##
2022-09-14 14:28:06 +00:00
cho1=" Entire screen"
cho2=" Entire screen with delay"
cho3=" Focused window"
cho4=" Select area"
2022-09-13 01:06:55 +00:00
chos="$cho1\n$cho2\n$cho3\n$cho4"
## DELAY OPTIONS ##
2022-09-14 14:28:06 +00:00
del1=" 3 sec delay"
del2=" 5 sec delay"
del3=" 10 sec delay"
2022-09-13 01:06:55 +00:00
dels="$del1\n$del2\n$del3"
## DELAY FUNCTION ##
delays() {
2023-02-20 19:20:24 +00:00
del=$(echo -e "$dels" | rofi -dmenu -i -p "  Select Delay ");
2022-09-13 01:06:55 +00:00
case $del in
2022-12-17 01:48:07 +00:00
"$del1")
2022-09-13 01:06:55 +00:00
scrot -d 3 && notify-send "Screenshot saved";;
2022-12-17 01:48:07 +00:00
"$del2")
2022-09-13 01:06:55 +00:00
scrot -d 5 && notify-send "Screenshot saved";;
2022-12-17 01:48:07 +00:00
"$del3")
2022-09-13 01:06:55 +00:00
scrot -d 10 && notify-send "Screenshot saved"
esac
}
## ENTIRE SCREEN FUNCTION ##
screen() {
scrot && notify-send "Screenshot saved"
}
## FOCUSED WINDOW FUNCTION
window() {
scrot -u -b && notify-send "Screenshot saved."
}
## SELECTED AREA FUNCTION ##
area() {
scrot -s && notify-send "Screenshot saved."
}
## MAIN ACTION ##
2023-02-20 19:20:24 +00:00
choice=$(echo -e "$chos" | rofi -dmenu -i -p "  Sreenshot Menu ")
2022-09-13 01:06:55 +00:00
case $choice in
2022-12-17 01:48:07 +00:00
"$cho1")
2022-09-13 01:06:55 +00:00
screen;;
2022-12-17 01:48:07 +00:00
"$cho2")
2022-09-13 01:06:55 +00:00
delays;;
2022-12-17 01:48:07 +00:00
"$cho3")
2022-09-13 01:06:55 +00:00
window;;
2022-12-17 01:48:07 +00:00
"$cho4")
2022-09-13 01:06:55 +00:00
area
esac