make irfanview default image viewer
I want to click an image in nautilus to have it loaded in Irfanview.
I use Gnome and when I want to open an image in irfanview with wine, I right-click the image in nautilus and choose 'Open with other application' - in 'Use a custom command' I write 'wine /path/to/irfanview.exe'. This will open up irfanview but the image isn't loaded. So I have to open the image from Irfanview - annoying! If I use command line $ wine /path/to/irfanview.exe IMG_0261.jpg, it will load the image when Irfanview starts. I want to make a script so I can just click the image in nautilus, the script is run and the image loaded, but I don't know how. So far I wrote a script called irfan.sh that contains the command line input: wine /path/to/irfanview.exe executing $ ./irfan.sh IMG_2304.JPG only starts irfanview but not the image. I need to get the image in there somehow. Help with basic scripting would be greatly appreciated!:) E |
I don't know how GNOME works. But in KDE, you
need to change the file association. You would need to change this in the control center -> ??? -> file association . Does GNOME has a control center? Also, some window managers have their own configurations. Look around (i.e., tools -> ???, etc) Sheng-Chieh |
Add $@ to your script, like this: wine /path/to/irfanview.exe $@
|
Thanks your help!
Adding $@ to my script makes it work in command line, but when I click an image in nautilus irfanview is started but no image is loaded. I don't know how nautilus passes the command to the script. If I change the script to just contain the line 'gqview' it will load the image in gqview. Any more suggestions? :confused: E |
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 |
Wow!
I can't believe it. It worked! Thanks alot dub.wav! :) :) I would like to learn a bit of scripting. What does does the code mean? Could you recommend a good place to start to learn some basic scripting? E :Pengy: |
I'd advise [1] for learning about scripting. It is aimed at bash, but there is a lot of similarity between bash and sh I think. And a lot of it applies to any shell. csh is a bit different though...
> #!/bin/sh This is the program that is used to run this script. All scripts should have a "shebang" line at the top, eg "#!/usr/bin/perl" for perl, something similar for python (not my language) or "#!/bin/bash" for bash. > IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe" > ROOT_DRIVE="Z:\\" These are just setting the variables, which are used later. > for arg > do > ... > done For every argument passed to the script (ie things typed after the script name, eg for "$ script file1 file2", the args are file1 and file2) > wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed > 's/\//\\/g')" Run wine. Pass it the value of the IRFANVIEW variable (set earlier) for the first argument. For the second argument, concatenate the root drive with $(echo "$arg" | sed 's/\//\\/g'). That bit takes the arguments passed to the script (a file name) and uses "sed" to convert any "/" into a "\". PS Does Linux have anything similar to Irfan? Though this script sort of does do it... [1] http://tldp.org/LDP/abs/html/ |
All times are GMT -5. The time now is 04:49 PM. |