-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenshot.sh
executable file
·33 lines (29 loc) · 1019 Bytes
/
screenshot.sh
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
#!/usr/bin/dash
alias maimselect='maim --noopengl --capturebackground --select --hidecursor --color=0.1,0.1,0.1,0.6 --highlight'
alias clip='xclip -selection c -filter'
case "$1" in
# select a region to screenshot (or click to screenshot window)
--select)
maimselect | clip -t image/png
notify-send "Maim" "Screenshot taken"
;;
# scan a QR code
--qr)
tmp_file=$(mktemp -t maimscript-XXXXXX)
maimselect > "$tmp_file"
scanresult=$(zbarimg --quiet --raw "$tmp_file" | tr -d '\n')
if [ -z "$scanresult" ]; then
notify-send "Maim" "No scan data found"
else
echo "$scanresult" | clip
convert $tmp_file -resize 75x75 "$tmp_file"
notify-send -i "$tmp_file" "Maim" "$scanresult\n(copied to clipboard)"
fi
rm "$tmp_file"
;;
# screenshot the entire desktop
*)
maim --noopengl | clip -t image/png
notify-send "Maim" "Screenshot taken"
;;
esac