Last active
December 13, 2017 13:43
-
-
Save skateman/de4ac914776a5cb767319cf6f98c119e to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# gifcast - easily create gif screencasts from a selected area | |
# | |
# The first run lets you select a rectangle and starts recording while the second run stops the recording. | |
# Tested on Fedora 24 with GNOME | |
# Dependencies: xrectsel, byzanz, convert (ImageMagick) | |
FILE="/run/user/${UID}/$(basename $0).pid" | |
if [ -f $FILE ]; then | |
PID=$(cat $FILE) | |
DEST="$(cat /proc/${PID}/cmdline | xargs -0 -n1 echo | tail -n1 )" | |
kill $PID | |
rm -rf $FILE | |
sleep 1 | |
convert "${DEST}" -loop 0 "${DEST}" | |
exit | |
fi | |
AREA=$(xrectsel "--x=%x --y=%y --width=%w --height=%h") | |
DEST="$(xdg-user-dir PICTURES)/Screencast from $(date "+%F %H-%M-%S").gif" | |
byzanz-record $AREA --duration=600 --cursor "${DEST}" & | |
CAST=$! | |
echo $CAST > $FILE | |
trap "kill ${CAST}" 2 | |
wait $CAST | |
convert "${DEST}" -loop 0 "${DEST}" | |
rm -f $FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fedora packages: