-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssc
More file actions
executable file
·104 lines (87 loc) · 2.86 KB
/
ssc
File metadata and controls
executable file
·104 lines (87 loc) · 2.86 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
#############################################################
# SSC - Linux screenshot script
#
# Take screenshot (window, selection, fullscreen), upload
# to ftp, imageshack, or none and copy URL/file location
# to clipboard
#
# Dependencies: scrot, xclip, zenity, imagemagick
#
# Author: David Ryder
# Website: http://wildreason.com
#############################################################
echo "You may minimize this window"
echo ""
echo "Modes:"
echo ""
echo "Full screen: automatically capture the entire screen. No action required."
echo "Window: When crosshair appears, click anywhere in the window you wish to capture"
echo "Selection: Choose a region on the screen with your mouse"
source ssc.cfg
install_deps() {
zenity --question --text="Missing one or more dependencies (imagemagick, xclip, scrot, zenity). Install dependencies?"
if [ "$?" = "0" ]; then
echo -e "\nAttempting to install missing dependencies. . ."
`$install_app "$install_command" > /dev/null`
echo -e "\nInstall complete. Continuing. . .\n"
else
exit 1
fi
}
send_ftp() {
curl ftp://$ftp_hostname/$ftp_save_dir/ --user $ftp_user:$ftp_pass -T $ufile -#
}
send_imageshack() {
tmpfile=$(mktemp) || exit 1
curl -H Expect: -F fileupload="@${ufile}" -F xml=yes http://www.imageshack.us/index.php -# > $tmpfile
}
install_dep="unans"
which import > /dev/null
if [ "$?" = "1" ] ; then
install_deps
fi
which xclip > /dev/null
if [ "$?" = "1" ]; then
install_deps
fi
which scrot > /dev/null
if [ "$?" = "1" ]; then
install_deps
fi
which zenity > /dev/null
if [ "$?" = "1" ]; then
install_deps
fi
ufile=ss_$(date +%b_%d_%Y_%H%M).jpg
action=`zenity --list --column="Choose option" "Full screen" "Window" "Selection"`
if [ "$action" != "Full screen" ] && [ "$action" != "Window" ] && [ "$action" != "Selection" ]; then
exit
fi
sleep .4
# We will capture the screen based on previous selection here
if [ "$action" = "Full screen" ]; then
scrot -q $quality "$ufile"
elif [ "$action" = "Window" ]; then
import $ufile
else
scrot -q $quality -s "$ufile"
fi
# Opens a program to edit image, if selected
if [ "$program" != "0" ]; then
$program "$ufile"
fi
if [ "$mode" = "imageshack" ] ; then
send_imageshack #2>&1 | awk '{ print $2; fflush() }' | zenity --progress --text="Uploading..."
echo $(cat $tmpfile | grep -E "<image_link>(.*)</image_link>" | sed 's|<image_link>\(.*\)</image_link>|\1|') | xclip -selection clipboard
rm -rf $tmpfile
zenity --info --text="Upload complete" --title="Screenshot complete"
elif [ "$mode" = "ftp" ] ; then
send_ftp
echo -n "$screenshot_url/$ufile" | xclip -selection clipboard
zenity --info --text="Upload complete" --title="Screenshot complete"
else
zenity --info --text="Image ($ufile) saved to $local_save_dir" --title="Saved locally"
echo -n "$local_save_dir/$ufile" | xclip -selection clipboard
fi
exit