-
-
Save koddsson/4c3cf821576370fa004f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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