How to record your screen into an animated gif with precise position and size?
I would like to create an animated gif with a size of 800x600px. The canva should contain a web browser in the top half, and a command-line terminal in the bottom half.
Placing the windows via command-line
Windows can be place precisely using wmctrl. See [1].
Use wmctrl -l to list current windows. Then place the Firefox browser and the terminal using an unambiguous part of their window title:
wmctrl -r "Mozilla Firefox" -e 0,100,100,803,300 wmctrl -r "inapp2" -e 0,100,400,804,290
The terminal window cannot have a pixel accurate size because it has to match the size of text lines and columns.
In order to simplicy the default bash prompt, a new one can be set using the environmental variable PS1:
export PS1='$ '
Recording session
An animated gif can be recorded with byzanz. See [2]:
byzanz-record --duration=100 --x=100 --y=100 --width=804 --height=604 inapp2_demo.gif
The duration of 100 seconds will be interupted with Ctrl+C.
Result

References
[1] | AskUbuntu, "Center a window via command line", http://askubuntu.com/a/104190 |
[2] | AskUbuntu, "How to record my screen?", http://askubuntu.com/a/13462 |