Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
byzanz-record-window.sh
#!/bin/bash
# Directory to output the videos
DESTDIR=~/Videos/
# Delay before starting
DELAY=10
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga &
}
# Duration and output file
if [ $# -gt 0 ]; then
D="--duration=$@"
else
FILENAME="${DESTDIR}recorded-$RANDOM.gif"
echo Default recording duration 10s to /tmp/recorded.gif
D="--duration=10 ${FILENAME}"
fi
XWININFO=$(xwininfo)
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO")
read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO")
read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO")
echo Delaying $DELAY seconds. After that, byzanz will start
for (( i=$DELAY; i>0; --i )) ; do
echo $i
sleep 1
done
beep
byzanz-record --verbose --delay=0 --x=$X --y=$Y --width=$W --height=$H $D
beep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.