Anyone got ueberzug image previews working in vifm?


I was playing around with ueberzug, which is a possbly more consistent replacement for the w3m image preview. Give it an images and a location/dimensions for it and it will print it to the terminal. The preview will survive after multiple resizing, mouse away and anything else. Much more robust than w3mimg.

A brief example in bash. I recommend installing ueberzug via pip to ensure all the right dependencies.

source "`ueberzug library`"
declare -A command=([path]="pix/image.png" [identifier]="name" [action]="add" [x]="0" [y]="0" [max_width]="400" [height]="400")

The above will print pix/image.png in the top left (0x0) and ensure it fits within 400x400 by resizing it. If you spawn a bunch more windows and move it around, the image is very consistent.

Now vifm does provide some built-in arguments for the size of the preview window and location, but despite a little tinkering, I couldn't actually get any previews to pop up. I tried in my build of st, urxvt and alacritty and none worked in vifm.

I could toy around with it a little more and figure it out, but if any of you guys have already done it, feel free to share your script/command to do it. Ideally I'd like vifm previews, but also an independent script that could simply print out an image argument to the command line.