helm/home/profiles/desktop/bin/screenshot

57 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-09-18 15:13:50 -07:00
#!/usr/bin/env bash
timer=5
# Options
2023-08-16 23:35:52 -07:00
select="󰩭 "
window=" "
screen=" "
record=" "
2023-08-16 23:35:52 -07:00
delay="󱑃 "
cancel="󰜺 "
2022-09-18 15:13:50 -07:00
# 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
2022-09-18 15:13:50 -07:00
esac