2018-02-08 VF-1 on Windows

On Windows with Cygwin, image viewers do not work without X11. So what was I to do for VF-1? If I used a native Winows application, it was unable to deal with the Cygwin file name. Argh! I needed a middle man that handles this for me.

I created `~/.config/vf1/vf1rc` and added the following:

handler image/* paint %s

I have added `~/bin` to my `$PATH` and created `~/bin/paint` as follows:

#!/bin/bash
IMG=$(echo $1 | sed -e "s/\/cygdrive\/c/C:/")
if (file $IMG | grep -q "PNG image data"); then
   mv "$IMG" "$IMG.png"
   IMG=$IMG.png
elif (file $IMG | grep -q "JPEG image data"); then
   mv "$IMG" "$IMG.jpg"
   IMG=$IMG.jpg
fi
echo Opening $IMG
exec "C:/Program Files/Paint.NET/PaintDotNet.exe" "$IMG"

And now images open in Paint.NET. 😄

​#Gopher

Comments

(Please contact me if you want to remove your comment.)

cygpath might also be helpful here!

cygpath

– Aaron 2018-02-16 16:25 UTC

Aaron

---

Oh! I was unaware of this utility. This is exactly what I need, thanks!

– Alex Schroeder 2018-02-16 21:00 UTC