Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #! /usr/bin/env bash
  2.  
  3. # This script uses byzanz-record to generate an animated Gif for your interactions
  4. # with a window
  5. # usage:
  6. # Record a window for 3 seconds and save to /home/foo/yo.gif
  7. # byzanz-record-window 3 /home/foo/yo.gif
  8. #
  9. # without parameters, it defaults to 10s and a target file in /tmp/screencast.gif
  10. #
  11.  
  12. # Sound notification to let one know when recording is about to start (and ends)
  13. beep() {
  14. paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &
  15. }
  16.  
  17. # Delay before starting
  18. DELAY=3
  19.  
  20. # Duration
  21. DURATION=10
  22. if [ $# -gt 0 ]; then
  23. DURATION=$1
  24. fi
  25.  
  26. # File target
  27. TARGET='/tmp/screencast.gif'
  28. if [ $# -gt 1 ]; then
  29. TARGET=$2
  30. fi
  31.  
  32. echo Recording duration of ${DURATION}s to $TARGET.
  33. echo Click on the window you want to record.
  34.  
  35. XWININFO=$(xwininfo)
  36. read X <<< $(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
  37. read Y <<< $(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO")
  38. read W <<< $(awk -F: '/Width/{print $2}' <<< "$XWININFO")
  39. read H <<< $(awk -F: '/Height/{print $2}' <<< "$XWININFO")
  40.  
  41. echo Delaying $DELAY seconds. After that, byzanz will start
  42.  
  43. for (( i=$DELAY; i>0; --i )) ; do
  44. echo $i
  45. sleep 1
  46. done
  47.  
  48. beep
  49. byzanz-record --verbose --delay=0 --x=$X --y=$Y --width=$W --height=$H --duration=$DURATION $TARGET
  50. beep
  51. notify-send "Screencast created"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement