Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save predragnikolic/fd6714ddc7f5af9ba828ed0372bbc4f0 to your computer and use it in GitHub Desktop.
Save predragnikolic/fd6714ddc7f5af9ba828ed0372bbc4f0 to your computer and use it in GitHub Desktop.
~/.recordWindow 10 -c good.gif
#!/bin/bash
# INSTALL
# 1) clone to a folder (I have a ~/software one)
# 2) Add the following to your ~/.bashrc
# alias byzanz-record-window='/home/todd/software/byzanz-record-window'
# Delay before starting
DELAY=3
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/ubuntu/stereo/message-new-instant.ogg &
}
# Duration and output file
if [ $# -gt 0 ]; then
D="--duration=$@"
else
echo Default recording duration 10s to /tmp/recorded.gif
D="--duration=10 /tmp/recorded.gif"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment