LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting Irfanview as Default Viewer (https://www.linuxquestions.org/questions/linux-newbie-8/setting-irfanview-as-default-viewer-673860/)

Ray2047 10-02-2008 08:05 PM

Setting Irfanview as Default Viewer
 
I have the Windows program Irfanview installed in Wine. I want to click on a an image file and have it automatically open the image. The closest I've come is getting Irfanview to open but then I have to manually select the image to open.

I found the solution here but just don't know enough to implement it. I started a new post because the original is three years old. http://www.linuxquestions.org/questi...viewer-355622/

My OS is PCLOS with KDE desk top. Any help appreciated. I tried a few things by guess to get it to work but no luck.

sydney-troz 10-02-2008 10:30 PM

In KDE, go to the KMenu, System Settings, click on Default Applications, and select File Associations on the left. Expand "images", and select the format you want. On the right, go to the General tab, under Application Preference Order click Add, then select the menu item for Irfanview if you've created one, else type the command in. You'll have to do that for each format, as far as I know (unless you want to awk the config files or something). You can also get to the App Pref Order by right clicking on an image of that type and going to Properties.

Ray2047 10-03-2008 01:46 AM

Thanks but as I said that only causes Irfanview to open. If you will read the original thread you will see that was suggested but didn't work. It took a script to get it to work and I just don't know how to implement the script.

From the original post:
Quote:

I forgot you were talking about wine yesterday, obviously IrfanView expects a path in windows form.

Doesn't work:
wine Program\ Files/IrfanView/i_view32.exe "/home/jss/Pictures/2005, June, 13/dscn0349.jpg"
wine Program\ Files/IrfanView/i_view32.exe "Z:/home/jss/Pictures/2005, June, 13/dscn0349.jpg"

Works:
wine Program\ Files/IrfanView/i_view32.exe "Z:\\home\\jss\\Pictures\\2005, June, 13\\dscn0349.jpg"

Try this wrapper script.
Code:


#!/bin/sh
IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe"
ROOT_DRIVE="Z:\\"
for arg
do
        wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed 's/\//\\/g')"
done



i92guboj 10-03-2008 02:47 AM

I assume you are launching this from konqueror or any other kpart. Kde uses an odd naming for parameters.

I think it uses %u for files and %s for urls, or something like that.

So, if you associate a given program to a file type you will need to specify the parameter as well (otherwise it will just open the viewer, as it's doing for you right now).

For example, to open jpeg files with feh, you would specify "feh %u", and not just "feh".

If you need to open a wrapper, like in your example, remember that you are passing arguments to it. If you pass the file name in kde using %u, and it's the only argument, then you will be able to access it as $1 in a shell script. So, you'd do:

Code:

wine inrfanview "$1"
To pass the first positional parameter that konqueror sent to the script to irfanview.

Ray2047 10-03-2008 12:13 PM

i92guboj I appreciate the answer but it brings me back to the problem I had with the original post. It tells me what to do but not how to do it.

i92guboj 10-03-2008 02:12 PM

Quote:

Originally Posted by Ray2047 (Post 3299166)
i92guboj I appreciate the answer but it brings me back to the problem I had with the original post. It tells me what to do but not how to do it.

Open konqueror, open it's configuration dialog, go to wherever the file associations are set. Select the file extension that you want to change the viewer for. Now set as viewer something like "/path/to/your/script.sh %u", and make sure that it's the first one in the list if you have any others.

[Sorry for not being more concrete, but I only have konqueror 4 and I don't have 3.x right now to take a closer look. However it should be easy enough to figure those steps.]

Now, edit /path/to/your/script.sh and put inside this:

Code:

#!/bin/bash
wine /path/to/irfanview.exe "$1"

Make sure it's executable with:

Code:

chmod u+x /path/to/your/script.sh

Ray2047 10-03-2008 11:43 PM

Thank you, i92guboj. That was exactly the info I needed. Don't worry about not being exact. As long as I know the basics the rest I can usually figure out.

i92guboj 10-04-2008 11:12 AM

Quote:

Originally Posted by Ray2047 (Post 3299728)
Thank you, i92guboj. That was exactly the info I needed. Don't worry about not being exact. As long as I know the basics the rest I can usually figure out.

Nice. Let us know if it works :)

Ray2047 10-04-2008 11:54 PM

Quote:

Originally Posted by i92guboj (Post 3300145)
Nice. Let us know if it works :)

Probably wait till my day off. I've learned the hard way, you come in from work at 11 pm, set down to do a bit of work on the computer and the next time you look at the clock it's past 3 in the morning. I'll let you know though.

Ray2047 10-08-2008 10:15 PM

Just a quick note that i92guboj. instructions worked for me with minor alterations. I made the file association changes in the KDE control center not konqueror. For reasons I'm not sure of I couldn't make the ".sh" file executable from command line so just did it from GUI.

Thanks i92guboj.


All times are GMT -5. The time now is 03:29 AM.