Skip to content

Instantly share code, notes, and snippets.

@vittorioromeo
Last active December 22, 2015 05:29
Show Gist options
  • Save vittorioromeo/6424417 to your computer and use it in GitHub Desktop.
Save vittorioromeo/6424417 to your computer and use it in GitHub Desktop.
byzanz-record window gif
#!/bin/sh
INFO=$(xwininfo -frame)
WIN_GEO="--width="
WIN_GEO="$WIN_GEO$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')"
WIN_XY="--x="
WIN_XY="$WIN_XY$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/ --y=/' )"
WIN_HEI=`echo $WIN_GEO | sed s/x/\\ --height=/g`
filename="$1.gif"
rm $filename
function ctrl_c()
{
sleep 1
convert $filename -loop 0 $filename
echo "done"
}
trap ctrl_c INT
echo "recording $filename, quit with ctrl-c"
byzanz-record --duration=10000 $WIN_XY $WIN_HEI --delay=0 "$filename"
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment