-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd-sshot
executable file
·42 lines (33 loc) · 1.5 KB
/
d-sshot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
source d-var.conf
menuopts=(" Select Area in Mouse" " Copy Area of Screen" " Full Display" " Copy Whole Display" " Active Window")
nameopts=(
"notes-refer"
"receipt-"
"ppt-pic"
"share-detail"
)
sleep_for='sleep 0.5'
temp_pic='/tmp/thescr.png'
ident=$(date +%Y%m%dT%H%M%S)
gimme() {
output=$(date +'%d-%a %H:%M:%S')
picname=$(printf '%s\n' "${nameopts[@]}" | ${D_MENU} -l 5 -i -p ' ' || echo $output )
tagname=$(echo "" | ${D_MENU} -l 5 -i -p ' ')
cp $temp_pic ~/pics/sshots/"${ident}-${picname}_${tagname}.png"
}
sshot=$(printf '%s\n' "${menuopts[@]}" | sort | $D_MENU -p 'Snap ScreenShot of ')
case "$sshot" in
# "${menuopts[0]}") $sleep_for && grim -g "$(slurp)" "${temp_pic}" && gimme ;;
# "${menuopts[1]}") $sleep_for && grim -g "$(slurp)" - | wl-copy --type image/png ;;
# "${menuopts[2]}") $sleep_for && grim -c "${temp_pic}" && gimme ;;
# "${menuopts[3]}") $sleep_for && grim -c - | wl-copy --type image/pngi ;;
# "${menuopts[4]}") $sleep_for && grim -g \
# "$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')" "${temp_pic}" && gimme ;;
# # *) sleep 0.5 && grim "/tmp/thescr.png" || exit ;;
"${menuopts[0]}") grimblast save area "${temp_pic}" && gimme ;;
"${menuopts[1]}") grimblast copy area ;;
"${menuopts[2]}") grimblast save output "${temp_pic}" && gimme;;
"${menuopts[3]}") grimblast copy output ;;
"${menuopts[4]}") grimblast save active "${temp_pic}" && gimme;;
esac