Thursday, December 18, 2014 =========================== screencast gifs --------------- Looking to make some GIFs of things that happen on my screen, found `byzanz`. $ sudo apt-get install byzanz byzanz-record -x 1 -y 1 --delay=4 -h 150 -w 700 hello_world.gif Options: - `-x` and `-y` set origin of capture on screen - `-h` and `-w` set height and width to capture I think I need a more clever way to trigger / manage this than just fiddling with CLI options, but it works really well and produces lightweight image files. I think it would be cool if there were a utility that let me use arrow keys / hjkl / the mouse cursor to visually select a region of the screen. It could return x, y, height, and width, then I'd let byzanz handle the capture. That can't be the _hardest_ thing in the world to do. -> ☆ <- [xdotool](http://www.semicomplete.com/projects/xdotool/) seems like kind of a swiss army knife, and has a `getmouselocation` command. Theoretically, at least, you can have it respond to events, including a mouse click. I can't quite wrap my head around how this is supposed to work, and my first few attempts fall flat. [GNU xnee](https://www.gnu.org/software/xnee/) might also be promising, but I don't really get anywhere with it. Eventually I find an [Ask Ubuntu](http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast) thread on creating screencast gifs, which points to [xrectsel](https://github.com/lolilolicon/xrectsel), a tool for returning the coordinates and size of a screen region selected with the mouse: brennen@desiderata 22:06:28 /var/www/workings-book (master) ★ xrectsel "%x %y %w %h" 432 130 718 575% I wind up with [`gif_sel`](https://github.com/brennen/bpb-kit/blob/master/bin/gif_sel): #!/usr/bin/env bash # requires: # https://github.com/lolilolicon/xrectsel.git eval `xrectsel "BYZANZ_X=%x; BYZANZ_Y=%y; BYZANZ_WIDTH=%w; BYZANZ_HEIGHT=%h"` byzanz-record -x $BYZANZ_X -y $BYZANZ_Y --delay=4 -h $BYZANZ_HEIGHT -w $BYZANZ_WIDTH ~/screenshots/screencast-`date +"%Y-%m-%d-%T"`.gif I'll probably wind up with a couple of wrappers for this for different lengths of recording (for starting with dmenu), though it would be nice if I could just have it record until I press some hotkey.