tSpecify if you want to take only a window - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 4f742d1f052fbee5b81a8f425e4ea9ddbc9ad315
(DIR) parent e07485d517aab96dc5ebe45fc90c7be348545be0
(HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Mon, 14 Oct 2013 16:38:50 +0200
Specify if you want to take only a window
Diffstat:
M instagram | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/instagram b/instagram
t@@ -17,10 +17,11 @@ source ~/.config/instagram 2>/dev/null
function usage() {
cat <<SHBLAH
-Usage : instagram [-tmuh] [-g number] [-s screen] [filename.png]
+Usage : instagram [-tmuwh] [-g number] [-s screen] [filename.png]
-t : create thumbnail
-m : create one shot per head
-u : upload the file using $UPLOAD_BIN <filename>
+ -w : take only a window for the shot (choose with pointer)
-h : display this help
-d path : save the shot in <path>
-g number : create a gif out of <number> shot (0.5 second between shots)
t@@ -44,7 +45,10 @@ function upload() {
[[ "$1" = "--help" ]] && usage && exit 0
-while getopts ":htmud:g:s:" opt; do
+# default window id
+WINDOW='root'
+
+while getopts ":htmuwd:g:s:" opt; do
case $opt in
t) THUMB=1 ;;
m) MULTI=1 ;;
t@@ -52,6 +56,7 @@ while getopts ":htmud:g:s:" opt; do
g) GIF=$OPTARG ;;
s) SCREEN=$OPTARG ;;
u) UPLOAD=1 ;;
+ w) WINDOW=$(xprop|grep 'window id'|cut -d\ -f7);;
h) usage; exit 0;;
?) echo "invalid option: -$OPTARG"; exit 1 ;;
esac
t@@ -70,21 +75,21 @@ if [[ "$MULTI" = "1" ]] || [[ -n $SCREEN ]]; then
xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' |
while IFS=' :x@,' read i w h x y; do
if [[ $SCREEN = "$i" ]] || [[ -z $SCREEN ]]; then
- import -window root -crop ${w}x$h+$x+$y $SSHOT_DIR/head_$i-$OUTPUT
- [[ -n $THUMB ]] && import -window root -thumbnail 25% -crop ${w}x$h+$x+$y $SSHOT_DIR/thumb-head_$i-$OUTPUT
+ import -window ${WINDOW} -crop ${w}x$h+$x+$y $SSHOT_DIR/head_$i-$OUTPUT
+ [[ -n $THUMB ]] && import -window ${WINDOW} -thumbnail 25% -crop ${w}x$h+$x+$y $SSHOT_DIR/thumb-head_$i-$OUTPUT
fi
done
elif [ -n "$GIF" ]; then
mkdir $SSHOT_DIR/tmp
for i in $(seq 0 $GIF); do
- import -window root $SSHOT_DIR/tmp/gif${i}_${OUTPUT}
+ import -window ${WINDOW} $SSHOT_DIR/tmp/gif${i}_${OUTPUT}
sleep 0.5
done
convert -delay 100 -loop 0 $SSHOT_DIR/tmp/gif*$OUTPUT $SSHOT_DIR/${1/jpg/gif}
else
- import -window root $SSHOT_DIR/$OUTPUT
- [[ -n $THUMB ]] && import -window root -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT}
+ import -window ${WINDOW} $SSHOT_DIR/$OUTPUT
+ [[ -n $THUMB ]] && import -window ${WINDOW} -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT}
fi
if [[ "$UPLOAD" = "1" ]]; then