2020-05-08 20:35:40 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2020-05-11 20:23:12 +02:00
|
|
|
m() { rofi -dmenu -width 200 -i -l "$@"; }
|
2020-05-08 20:35:40 +02:00
|
|
|
|
2020-05-11 20:23:12 +02:00
|
|
|
mkdir -p ~/pix/Screenshots
|
|
|
|
screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png
|
|
|
|
|
|
|
|
screenshot() {
|
|
|
|
maim $type "$screen_path" &&
|
|
|
|
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!"
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "$1" = "--force" ] && { screenshot && exit; }
|
|
|
|
|
|
|
|
type="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')"
|
2020-05-11 10:48:19 +02:00
|
|
|
[ ! "$type" ] && exit
|
2020-05-11 20:23:12 +02:00
|
|
|
save="$(printf " No\n Yes" | m 2 -p 'Copy?')"
|
2020-05-11 10:48:19 +02:00
|
|
|
[ ! "$save" ] && exit
|
2020-05-11 20:23:12 +02:00
|
|
|
time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')"
|
2020-05-11 10:48:19 +02:00
|
|
|
[ ! "$time" ] && exit
|
2020-05-08 20:35:40 +02:00
|
|
|
|
2020-05-11 20:23:12 +02:00
|
|
|
[ "$type" = " Area" ] && type="-s -u" || type=""
|
2020-05-08 20:35:40 +02:00
|
|
|
|
2020-05-11 10:48:19 +02:00
|
|
|
sleep "$time"
|
2020-05-11 20:23:12 +02:00
|
|
|
screenshot
|
2020-05-08 20:35:40 +02:00
|
|
|
|
2020-05-11 20:23:12 +02:00
|
|
|
[ "$save" = " Yes" ] &&
|
2020-05-08 20:35:40 +02:00
|
|
|
xclip -sel clip /dev/null; sleep 0.5
|
2020-05-11 10:48:19 +02:00
|
|
|
xclip -selection clipboard -t image/png "$screen_path" || exit
|