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. :)

Tags:

Comments

cygpath might also be helpful here!

Aaron 2018-02-16 16:25 UTC


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

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


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.