Skip to content

Instantly share code, notes, and snippets.

@nikku
Last active May 21, 2020 23:12
Show Gist options
  • Save nikku/e0f2864461a37d76caf2 to your computer and use it in GitHub Desktop.
Save nikku/e0f2864461a37d76caf2 to your computer and use it in GitHub Desktop.
Animated Gif utility for X11 based systems

works badge

This is a simple script that allows you to choose an area that will be recorded into a 10s animated gif.

Usage

screencapture [dest-file]

You need X11 + xrectsel + byzanz-record. Get it from the cool guys.

Script

#!/bin/bash

echo "select screen region to capture"

rect=$(xrectsel)

dimensions=$(echo $rect | cut -d + -f 1)
width=$(echo $dimensions | cut -d x -f 1)
height=$(echo $dimensions | cut -d x -f 2)
x=$(echo $rect | cut -d + -f 2)
y=$(echo $rect | cut -d + -f 3)

echo "starting in 2"

sleep 2

echo "recording"
byzanz-record -w $width -h $height -x $x -y $y $@
echo "done."

echo "repeat screen capture via"
echo "> sleep 2 && echo \"recording\" && byzanz-record -w $width -h $height -x $x -y $y $@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment