Skip to content

Instantly share code, notes, and snippets.

@Shadey
Last active August 29, 2015 14:22
Show Gist options
  • Save Shadey/9982ce1284b6d4c849f3 to your computer and use it in GitHub Desktop.
Save Shadey/9982ce1284b6d4c849f3 to your computer and use it in GitHub Desktop.
#!/bin/sh
usage(){ echo "Usage: $0 filename";exit 0;}
#Checks for only one args and thats the username
[ "$#" -ne 1 ] && usage || filename=$1
#Gets all the info from xwininfo to figure out how to crop the desktop
read x y w h <<<$(xwininfo | grep -e Width -e Height -e Absolute | awk -F ":" '{ print $2}' | awk '$1=$1')
#Uses ffmpeg to record the desktop with x11grab
ffmpeg -y -draw_mouse 0 -video_size $w'x'$h -f x11grab -i $DISPLAY.0+$x,$y -preset veryfast $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment