Skip to content

Instantly share code, notes, and snippets.

@kalaomer
Created May 14, 2016 12:49
Show Gist options
  • Save kalaomer/2a81b1ea6098b9b239b85eb2fd0f12d1 to your computer and use it in GitHub Desktop.
Save kalaomer/2a81b1ea6098b9b239b85eb2fd0f12d1 to your computer and use it in GitHub Desktop.
byzanz-record-window
#!/bin/bash
#byzanz-record-window
#dependency checks
gif-receord()
{
if ! which xwininfo &>/dev/null; then
echo "Dependency xwininfo not met."
deps_ok=NO
fi
if ! which byzanz-record &>/dev/null; then
echo "Dependency byzanz not met."
deps_ok=NO
fi
if [[ $deps_ok == NO ]]; then
echo "Please install the needed dependencies any try again."
exit 1
fi
#get stuff from xwininfo
xwininfo=$(xwininfo -shape)
getnum()
{
echo "$xwininfo" | grep "$1" | tr -cd [:digit:]
}
x=$(getnum "Absolute upper-left X:")
y=$(getnum "Absolute upper-left Y:")
w=$(getnum "Width:")
h=$(getnum "Height:")
#record
sleep 5 &&
notify-send "record started" &&
byzanz-record $@ -x $x -y $y -w $w -h $h &&
notify-send "record ended"
}
@kalaomer
Copy link
Author

sleep function and notify added for informing. And gif-record function created for use with bash and zsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment