Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 30 lines (25 sloc) 847 Bytes
#!/bin/bash
# Records a region of the screen or a window to a gif
# Adapted from <http://askubuntu.com/a/201018>
# also see `man recordmydesktop` for more options
# hit CTRL+C to stop recording
# there's also a sxhkd binding to stop recording
if [[ $1 == 'region' ]]; then
OPTS=$(xrectsel "-x=%x -y=%y --width=%w --height=%h")
elif [[ $1 == 'window' ]]; then
OPTS="--windowid $(xwininfo | awk '/Window id:/ {print $4}')"
elif [[ $1 == 'full' ]]; then
OPTS=""
else
echo "Please specify 'full', 'region' or 'window'."
exit 0
fi
# https://github.com/lolilolicon/xrectsel
TIME=$(date +%F-%T)
VID=/tmp/recording_${TIME}.ogv
OUT=~/docs/shots/${TIME}.gif
recordmydesktop $OPTS -o $VID --overwrite --fps 24
notify-send "[rec] converting to gif..."
vid2gif -f 12 $VID $OUT
echo ${OUT} | xsel -b
notify-send "[rec] finished: ${OUT}"