2020-05-11 10:49:42 +02:00

24 lines
724 B
Bash
Executable File

#!/usr/bin/env sh
m() { rofi -dmenu -i -l "$@"; }
type="$(printf "Screen\nArea\n" | m 2 -p 'What do you want to screenshot?')"
[ ! "$type" ] && exit
save="$(printf "No\nYes" | m 2 -p 'Do you want to copy to clipboard?')"
[ ! "$save" ] && exit
time="$(printf "0.7\n5\n10\n15" | m 3 -p 'How many seconds you want to wait?')"
[ ! "$time" ] && exit
[ "$type" = "Area" ] && type="-s -u" || type=""
mkdir -p ~/pix/Screenshots
sleep "$time"
screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png
maim $type "$screen_path" &&
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!"
[ "$save" = "Yes" ] &&
xclip -sel clip /dev/null; sleep 0.5
xclip -selection clipboard -t image/png "$screen_path" || exit