Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env bash
- # This script uses byzanz-record to generate an animated Gif for your interactions
- # with a window
- # usage:
- # Record a window for 3 seconds and save to /home/foo/yo.gif
- # byzanz-record-window 3 /home/foo/yo.gif
- #
- # without parameters, it defaults to 10s and a target file in /tmp/screencast.gif
- #
- # Sound notification to let one know when recording is about to start (and ends)
- beep() {
- paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &
- }
- # Delay before starting
- DELAY=3
- # Duration
- DURATION=10
- if [ $# -gt 0 ]; then
- DURATION=$1
- fi
- # File target
- TARGET='/tmp/screencast.gif'
- if [ $# -gt 1 ]; then
- TARGET=$2
- fi
- echo Recording duration of ${DURATION}s to $TARGET.
- echo Click on the window you want to record.
- 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")
- 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 --x=$X --y=$Y --width=$W --height=$H --duration=$DURATION $TARGET
- beep
- notify-send "Screencast created"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement