ttygif - Error: WINDOWID environment variable was empty

Get the Error: WINDOWID environment variable was empty error-message when using ttygif? Try this:

export WINDOWID=$(xdotool getwindowfocus)

Prerequisites

Arch Linux

sudo pacman -S xdotool

Ubuntu

sudo apt-get install xdotool