Skip to content

Instantly share code, notes, and snippets.

@koddsson
Created July 22, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koddsson/4c3cf821576370fa004f to your computer and use it in GitHub Desktop.
Save koddsson/4c3cf821576370fa004f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Delay before starting
DELAY=3
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
}
DURATION_SET=0
FILE_SET=0
D=""
while getopts "hd:f:" opt; do
case "$opt" in
h)
echo "This is tool for making gifs"
exit 0
;;
d)
D="$D --duration=$OPTARG"
DURATION_SET=1
;;
f)
echo Default recording duration 10s to /tmp/recorded.gif
D="$D $OPTARG"
FILE_SET=1
;;
esac
done
if [ $DURATION_SET -eq 0 ]; then
D="$D --duration=10"
fi
if [ $FILE_SET -eq 0 ]; then
D="$D /tmp/recorded.gif"
fi
# xrectsel from https://github.com/lolilolicon/FFcast2/blob/master/xrectsel.c
ARGUMENTS=$(xrectsel "--x=%x --y=%y --width=%w --height=%h") || exit -1
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 ${ARGUMENTS} $D
beep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment