Skip to content

Instantly share code, notes, and snippets.

@chr15m
Created October 28, 2020 04:14
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 chr15m/915fa9ef94a4886b746ac80d76ae4d26 to your computer and use it in GitHub Desktop.
Save chr15m/915fa9ef94a4886b746ac80d76ae4d26 to your computer and use it in GitHub Desktop.
Python wrapper for byzanz-record to capture gifs
#!/usr/bin/env python
# You'll need to have `xrectsel` and `byzanz-record` installed
from __future__ import print_function
import re
import sys
import subprocess
if len(sys.argv) == 1:
print("You must supply at least a filename")
print(" -h for byzanz-record help")
else:
if sys.argv[1] == "-h":
print(subprocess.check_output(['byzanz-record', "--help"]))
else:
w,h,x,y = re.split("[+x]", subprocess.check_output(['xrectsel']).decode("utf8").rstrip("\n"))
args = ['byzanz-record', "-x", x, "-y", y, "-w", w, "-h", h] + sys.argv[1:]
print(" ".join(args))
print(subprocess.check_output(args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment