Skip to content

Instantly share code, notes, and snippets.

@lslezak
Created February 16, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lslezak/b9a2f3e91e1861ee08931426e71fa2cb to your computer and use it in GitHub Desktop.
Save lslezak/b9a2f3e91e1861ee08931426e71fa2cb to your computer and use it in GitHub Desktop.
byzanz-record-window script
#!/bin/bash
#byzanz-record-window
#dependency checks
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)
echo "$xwininfo"
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:")
echo "Recording window at $x,$y with size ${w}x$h"
#record
byzanz-record $@ -x $x -y $y -w $w -h $h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment