How to render GIF animations in urxvt in order to integrate animated previews in ranger?

878 Views Asked by At

Ranger optionally uses the w3mimgdisplay binary in order to display image previews in the terminal. Similarly I would like animated gifs to be animated in ranger's preview area. I've been testing in urxvt:

#! /bin/bash
clear
gifsicle -e $1
for f in *.gif.*
 do
  sleep .05s
  echo -e "0;1;0;0;200;160;;;;;$f\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay
  rm $f
done
clear

But that's ugly I know. I'd much rather choose the window id for gifview like gifview -w 0x360000b -a some.gif but weird stuff happens with the urxvt background and I want to be able to have ranger control the width and position. The preview should be scalable and auto-repeating. If the original frame rate is sacrificed, so be it.

0

There are 0 best solutions below