Skip to content

Instantly share code, notes, and snippets.

@toddhalfpenny
Last active June 29, 2016 19:32
Show Gist options
  • Save toddhalfpenny/a042f5239d40cc20e3aff8c33b15e571 to your computer and use it in GitHub Desktop.
Save toddhalfpenny/a042f5239d40cc20e3aff8c33b15e571 to your computer and use it in GitHub Desktop.
byzanz record a selectable region
#!/bin/bash
# INSTALL
# 1) clone to a folder (I have a ~/software one)
# 2) Add the following to your ~/.bashrc
# alias byzanz-record-region='/home/todd/software/byzanz-record-region'
# 3) Deps ->
## https://github.com/lolilolicon/xrectsel
## libx11 (synaptic)
## byzanz (synaptic)
## dh-autoreconf (synaptic)
# Delay before starting
DELAY=5
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/ubuntu/stereo/message-new-instant.ogg &
}
# Duration and output file
if [ $# -gt 0 ]; then
D="--duration=$@"
else
echo Default recording duration 10s to /tmp/recorded.gif
D="--duration=10 /tmp/recorded.gif"
fi
# xrectsel from https://github.com/lolilolicon/xrectsel
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment