LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-02-2008, 09:05 PM   #1
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Rep: Reputation: 15
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.
 
Old 10-02-2008, 11:30 PM   #2
sydney-troz
Member
 
Registered: Feb 2007
Distribution: Kubuntu, it's obese barely-usable sibling, Ubuntu
Posts: 142

Rep: Reputation: 15
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.
 
Old 10-03-2008, 02:46 AM   #3
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Original Poster
Rep: Reputation: 15
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

Last edited by Ray2047; 10-03-2008 at 02:51 AM.
 
Old 10-03-2008, 03:47 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
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.

Last edited by i92guboj; 10-03-2008 at 03:49 AM.
 
Old 10-03-2008, 01:13 PM   #5
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
Old 10-03-2008, 03:12 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by Ray2047 View Post
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

Last edited by i92guboj; 10-03-2008 at 03:19 PM.
 
Old 10-04-2008, 12:43 AM   #7
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
Old 10-04-2008, 12:12 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by Ray2047 View Post
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
 
Old 10-05-2008, 12:54 AM   #9
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
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.
 
Old 10-08-2008, 11:15 PM   #10
Ray2047
Member
 
Registered: Dec 2005
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
make irfanview default image viewer ebsbel Linux - Software 6 02-10-2008 01:34 PM
Evince as a default viewer nmansour Linux - Software 5 10-20-2007 12:54 AM
mplayer as the default viewer fof3 Linux - Desktop 2 07-09-2007 05:55 AM
Changing default vi viewer in slackware 10 shaun85 Linux - Newbie 5 10-23-2004 02:47 AM
setting acroread as default PDF viewer mecherd Linux - Newbie 3 04-15-2004 04:27 PM


All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration