Last active
February 14, 2017 00:23
-
-
Save everaldo/35905607af5f23379be945d895b34411 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 | |
# MODIFICADO POR EVERALDO GOMES EM 13/02/2017 | |
# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc) | |
# NAME: GIFRecord 0.1 | |
# DESCRIPTION: A script to record GIF screencasts. | |
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html) | |
# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd) | |
# Time and date | |
TIME=$(date +"%Y-%m-%d_%H%M%S") | |
# Delay before starting | |
DELAY=10 | |
# Standard screencast folder | |
FOLDER="$HOME/Imagens" | |
# Default recording duration | |
DEFDUR=10 | |
# Sound notification to let one know when recording is about to start (and ends) | |
beep() { | |
paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga & | |
} | |
# Custom recording duration as set by user | |
USERDUR=$(kdialog --title "Duration?" --inputbox "Please enter the screencast duration in seconds" 200 100) | |
# Duration and output file | |
if [ $USERDUR -gt 0 ]; then | |
D=$USERDUR | |
else | |
D=$DEFDUR | |
fi | |
USERDELAY=$(kdialog --title "Delay?" --inputbox "Please enter the default delay in seconds" 200 100) | |
# Delay | |
if [ $USERDELAY -gt 0 ]; then | |
DELAY=$USERDELAY | |
fi | |
# Window geometry | |
XWININFO=$(xwininfo) | |
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO") | |
read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO") | |
read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO") | |
read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO") | |
# Notify the user of recording time and delay | |
notify-send "GIFRecorder" "Recording duration set to $D seconds. Recording will start in $DELAY seconds." | |
#Actual recording | |
sleep $DELAY | |
beep | |
byzanz-record -c --verbose --delay=0 --duration=$D --x=$X --y=$Y --width=$W --height=$H "$FOLDER/GIFrecord_$TIME.gif" | |
beep | |
# Notify the user of end of recording. | |
notify-send "GIFRecorder" "Screencast saved to $FOLDER/GIFrecord_$TIME.gif" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment