helm/home/profiles/desktop/bin/screenshot
2023-10-24 15:18:27 -07:00

57 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
timer=5
# Options
select="󰩭 "
window=" "
screen=" "
record=" "
delay="󱑃 "
cancel="󰜺 "
# Variable passed to rofi
options="$select\n$window\n$screen\n$delay\n$cancel"
rofi_command="rofi -theme theme/screenshotmenu.rasi"
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
;;
$record)
kooha
esac