Skip to content

Commit f149689

Browse files
committed
some scripts added
1 parent 23dadd2 commit f149689

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

Contributors

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if you want to add your usefull script in collection,
2+
fork https://github.com/onlyshk/bash-snippets and pull-request.
3+
4+
Contributers:

LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (C) <2010> <Kuleshov Alexander>
2+
3+
This program is free software: you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation, either version 3 of the License, or
6+
(at your option) any later version.
7+
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU General Public License for more details.
12+
13+
You should have received a copy of the GNU General Public License
14+
along with this program. If not, see <http://www.gnu.org/licenses/>.

take_screenshot.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
prefix="$HOME/screenshot"
3+
date="$(date -I)"
4+
type='png'
5+
quality='90'
6+
wnd='-window root'
7+
8+
function help(){
9+
cat << EOF
10+
Usage: `basename $0` [options] [filename]
11+
Options:
12+
-f fullscreen shot (default)
13+
-r region shot
14+
-w single window shot
15+
EOF
16+
exit 1
17+
}
18+
19+
while getopts fwr opt; do
20+
case "$opt" in
21+
f) wnd='-window root' ;;
22+
w) wnd="-window $(xwininfo | awk '/Window\ id:/{print $4}')" ;;
23+
r) wnd='' ;;
24+
?) help ;;
25+
esac
26+
done
27+
28+
shift $((OPTIND-1))
29+
30+
if [ "x$1" == "x" ]
31+
then
32+
i=0
33+
name=${prefix}_$date.$type
34+
while [ -f "$name" ]; do
35+
i=$(($i+1))
36+
name=${prefix}_${date}_$i.$type
37+
done
38+
else
39+
name=$1
40+
fi
41+
42+
import $wnd -quality $quality $name

0 commit comments

Comments
 (0)