Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Record screen region with Byzanz and xrectsel
#Records selected screen region, with GUI
#This is combined version of GIF recording scripts, that can be found here:
#Thanks to Rob W, and the other author (unmentioned), for creating this lovely scripts
#I do not own any rights to code I didn't write
# ~Jacajack
DELAY=5 #Delay before starting
DEFDUR=10 #Default recording duration
TIME=$(date +"%Y-%m-%d_%H%M%S") #Timestamp
FOLDER="$HOME/Pictures/Byzanz" #Default output directory
#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=$(gdialog --title "Duration?" --inputbox "Please enter the screencast duration in seconds" 200 100 2>&1)
#Duration and output file
if [ $USERDUR -gt 0 ]; then
#Get coordinates using xrectsel from
REGION=$(xrectsel "--x=%x --y=%y --width=%w --height=%h") || exit -1
notify-send "GIFRecorder" "Recording duration set to $D seconds. Recording will start in $DELAY seconds."
for (( i=$DELAY; i>0; --i )) ; do
sleep 1
byzanz-record --cursor --verbose --delay=0 ${REGION} --duration=$D "$FOLDER/byzanz-record-region-$TIME.gif"
notify-send "GIFRecorder" "Screencast saved to $FOLDER/byzanz-record-region-$TIME.gif"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.