forked from bannatech/settings
/
mshot
executable file
·42 lines (35 loc) · 814 Bytes
/
mshot
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
#!/bin/bash
##################################################
## Takes a screenshots and puts it on a server. ##
##################################################
OS=$(uname)
ECODE=0
if [ "$1" = "" ]; then
echo "mshot <name> [select] [local]"
exit 1
fi
sleep 0.2
DIR=$(mktemp -d /tmp/mshot.XXXXXXXXXX)
if [ "$OS" = "Darwin" ]; then
screencapture "$DIR/pic.png"
else
if [ "$2" = "select" ]; then
gnome-screenshot -a -f "$DIR/pic.png"
else
gnome-screenshot -f "$DIR/pic.png"
fi
fi
if [ "$1" = ":clipboard:" ]; then
xclip -selection clipboard -target image/png "$DIR/pic.png"
else
mupload-weblet "$DIR/pic.png" "img/${1}.png"
fi
if [ $? -eq 0 ]; then
msound camera-shutter
else
merror "mshot" "Couldn't upload image file."
echo "An error occurred." 1>&2
ECODE=1
fi
rm -r "$DIR"
exit "$ECODE"