Skip to content

Instantly share code, notes, and snippets.

@hsingh23
Created October 26, 2015 02:15
Show Gist options
  • Save hsingh23/778e235d8f364595227e to your computer and use it in GitHub Desktop.
Save hsingh23/778e235d8f364595227e to your computer and use it in GitHub Desktop.
#!/bin/bash
# INFO=$(xwininfo -frame)
# WIN_GEO="--width="
# WIN_GEO="$WIN_GEO$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')"
# WIN_XY="--x="
# WIN_XY="$WIN_XY$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/ --y=/' )"
# WIN_HEI=`echo $WIN_GEO | sed s/x/\\ --height=/g`
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")
FILENAME=$HOME/Pictures/Screengif/$(date +"%Y-%m-%d_%H-%M-%S.gif")
mkdir -p $HOME/Pictures/Screengif
beep() {
paplay /usr/share/sounds/purple/login.wav &
}
QUIT () {
sleep 1
convert $FILENAME -loop 0 $FILENAME
beep
}
trap QUIT INT
max=10
#for i in $(seq 10 -1 0)
#do
# echo "$i"
# sleep 1
#done
# delay=2
# echo Delaying $delay seconds. After that, byzanz will start
# for (( i=$delay; i > 0; --i )) ; do
# echo $i
# sleep 1
# done
beep
echo "recording $FILENAME, quit with ctrl-c"
byzanz-record --duration=10000 --x=$X --y=$Y --width=$W --height=$H --delay=0 "$FILENAME"
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment