helm/users/profiles/desktop/bin/screenshot

54 lines
1 KiB
Plaintext
Raw Permalink Normal View History

2022-09-01 08:12:18 -07:00
#!/usr/bin/env bash
timer=5
# Options
select="麗"
window="类"
screen=""
delay=""
cancel=""
# Variable passed to rofi
options="$select\n$window\n$screen\n$delay\n$cancel"
2022-09-01 08:38:07 -07:00
rofi_command="rofi -theme theme/screenshotmenu.rasi"
2022-09-01 08:12:18 -07:00
setFilename() {
directory="/tmp/"
filename="IMG_$(date +%Y%m%d_%H%M%S).jpg"
filepath=$directory$filename
}
notify() {
dunstify "Screenshot saved and copied to clipboard" -i accessories-screenshot
}
chosen="$(echo -e "$options" | $rofi_command -dmenu)"
case $chosen in
$select)
setFilename
maim -Buosd 0.25 \
| tee $filepath | xclip -selection c -t image/png
notify
;;
$window)
setFilename
maim -Buod 0.25 -i $(xdotool getactivewindow) \
| tee $filepath | xclip -selection c -t image/png
notify
;;
$screen)
setFilename
maim -Buod 0.25 \
| tee $filepath | xclip -selection c -t image/png
notify
;;
$delay)
setFilename
maim -Buod $timer \
| tee $filepath | xclip -selection c -t image/png
notify
;;
esac