Created
July 14, 2015 09:19
-
-
Save lorenzos/dd2f792f4eb948a139ee to your computer and use it in GitHub Desktop.
Records a portion of your screen to an animated GIF
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/bash | |
# | |
# RECORDS A PORTION OF YOUR SCREEN TO AN ANIMATED GIF | |
# | |
# REQUIREMENTS: | |
# byzanz: Screen recorder, found in repos | |
# zenity: Dialogs and notifications, found in repos | |
# xrectsel: Screen portion selector, found at https://github.com/lolilolicon/xrectsel | |
# | |
FILENAME=$(zenity --file-selection --save --confirm-overwrite --filename='/tmp/byzanz-record.gif') | |
if [[ -n "$FILENAME" ]]; then | |
DELAY=$(zenity --entry --title="Capture delay in seconds:" --text="Capture delay in seconds:" --entry-text="1" --width=260) | |
DURATION=$(zenity --entry --title="Capture duration in seconds:" --text="Capture duration in seconds:" --entry-text="8" --width=260) | |
RECT=$(xrectsel | sed -r 's/(.*)x(.*)\+(.*)\+(.*)/-x \3 -y \4 -w \1 -h \2/') | |
byzanz-record -d $DURATION --delay $DELAY $RECT "$FILENAME" | |
zenity --notification --title="GIF saved" --text="GIF saved. Click the button to open it" --timeout=4 | |
if [[ "$?" == "0" ]]; then | |
exo-open "$FILENAME" | |
fi | |
exit 0 | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment