aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-03-29 03:44:50 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2013-03-29 03:44:50 +0100
commit766adc8cb4221fd37b97d48aaa1b888cd83df1f2 (patch)
tree7903b6a034a337b2f1f74471ccef11b64cae9df4 /tools
parentqvm-screenshot: fix script name in comments (diff)
downloadlaurent-tools-766adc8cb4221fd37b97d48aaa1b888cd83df1f2.tar.xz
laurent-tools-766adc8cb4221fd37b97d48aaa1b888cd83df1f2.zip
qvm-screenrecord: add -s : select window to capture
Diffstat (limited to 'tools')
-rw-r--r--tools/qvm-screenrecord.sh31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/qvm-screenrecord.sh b/tools/qvm-screenrecord.sh
index 49f518d..50eb640 100644
--- a/tools/qvm-screenrecord.sh
+++ b/tools/qvm-screenrecord.sh
@@ -2,7 +2,8 @@
# Record desktop in Qubes Dom0 and copy video to AppVM
# Dependencies: recordmydesktop (sudo qubes-dom0-update recordmydesktop)
-# If you want create a keyboard shortcut, use "konsole -e qvm-screenrecord.sh -n"
+# If you want create a keyboard shortcut you should run it in Konsole
+# Example: konsole -e qvm-screenrecord.sh -s -n
# 2013, Laurent Ghigonis <laurent@p1sec.com>
DOM0_SHOTS_DIR=$HOME/shots
@@ -10,18 +11,21 @@ APPVM_SHOTS_DIR=/home/user/shots
QUBES_DOM0_APPVMS=/var/lib/qubes/appvms/
usage() {
- echo "$program [-hn]"
+ echo "$program [-hns]"
echo -e "\t-n : after capturing, run nautilus in AppVM"
+ echo -e "\t-s : select window to capture"
}
program="`basename $0`"
mode_nautilus=0
-opts="$(getopt -o hn -n "$program" -- "$@")"
+mode_select=0
+opts="$(getopt -o hns -n "$program" -- "$@")"
err=$?
eval set -- "$opts"
while true; do case $1 in
-h) usage; exit 1 ;;
-n) mode_nautilus=1; shift ;;
+ -s) mode_select=1; shift ;;
--) shift; break ;;
esac done
[[ $err -ne 0 ]] && usage && exit 1
@@ -29,11 +33,30 @@ esac done
mkdir -p $DOM0_SHOTS_DIR ||exit 1
d=`date +"%Y%m%d-%H%M"`
tmpname=$d.ogv
+
+if [ $mode_select -eq 1 ]; then
+ echo "[-] select window to record"
+ echo "Press <enter> when ready to select"
+ read a
+ unset x y w h
+ eval $(xwininfo | \
+ sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
+ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
+ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
+ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ record_opts="-x $x -y $y --width $w --height $h"
+ echo "[-] recording zone at ${x} ${y} size ${w} ${h}"
+else
+ echo "[-] recording root window"
+ record_opts=""
+fi
+
+echo
echo "============================="
echo "Hit Crtl-C to end the capture"
echo "============================="
echo
-recordmydesktop --no-sound -o $DOM0_SHOTS_DIR/$tmpname $@
+recordmydesktop --no-sound -o $DOM0_SHOTS_DIR/$tmpname $record_opts $@
size=`ls -hs $DOM0_SHOTS_DIR/$tmpname |cut -d' ' -f1`
title=`kdialog --inputbox "Enter capture title ($size)" --title "$program"`