24 lines
732 B
Bash
Executable File
24 lines
732 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 ~/Pictures/Screenshots
|
|
sleep "$TIME"
|
|
SCREEN_PATH=~/Pictures/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
|