MS application on Wine will not open its files

Questions about Wine on Linux
Locked
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

MS application on Wine will not open its files

Post by vine »

Hello:

I run on an up to date Devuan Beowulf ...

Code: Select all

groucho@devuan:~$ uname -a
Linux devuan 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
groucho@devuan:~$ 
... and have two MS based applications of which I am very fond of (Pegasus Mail and IrfanView), both running on Wine, which is directly responsible for my being able to move from MS to Linux OSs a few years ago as PMail was a deal-breaker for me.

Code: Select all

groucho@devuan:~$ wine --version
wine-4.0 (Debian 4.0-2)
groucho@devuan:~$ 
I'm having a problem loading the files I open with IrfanView as the files' Properties > Open With drop down menu does not list IrfanView (I have to look for it in Other Application but even then, once selected, it does not 'stick' and the drop down menu stays empty.

This causes that any IrfanView file (a huge list of graphic files) will not open like it should ie:on a mouse click and IrfanView will open but with no file loaded.

I can start IrfanView from the command line without any problems:

Code: Select all

groucho@devuan:~$ 
groucho@devuan:~$ wine "C:\Program Files (x86)\IrfanView\i_view32.exe"
groucho@devuan:~$ 
But clicking on a natively associated IrfanView file (graphics files) does not work, I have to open it via File > Open in the IrfanView menu.

I think this this started a couple of dist-upgrades ago.

It is clearly a file association problem.
Any idea on how to fix it?
Thanks in advance.

A.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: MS application on Wine will not open its files

Post by jkfloris »

Code: Select all

groucho@devuan:~$ wine --version
wine-4.0 (Debian 4.0-2)
groucho@devuan:~$ 
Does Wine 6.0 also have this problem?

Can the file associations be found in: ~/.local/share/applications/ or ~/.local/share/applications/wine

What is the output of:

Code: Select all

wine reg query "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations"
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
jkfloris wrote: Sat Feb 27, 2021 4:43 pm Does Wine 6.0 also have this problem?
Don't know.
This is the version available in the Devuan repository.
jkfloris wrote: Sat Feb 27, 2021 4:43 pm Can the file associations be found in: ~/.local/share/applications/ or ~/.local/share/applications/wine
No.
jkfloris wrote: Sat Feb 27, 2021 4:43 pm What is the output of:

Code: Select all

wine reg query "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations"
This:

Code: Select all

groucho@devuan:~$ wine reg query "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations"
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations
groucho@devuan:~$ 
I had not typed ...

Code: Select all

Regedit
... in eons.
It shows that the key is empty.

Thanks for your input.

V.
fargodwe

Re: MS application on Wine will not open its files

Post by fargodwe »

jkfloris is the expert so I hope you don't mind a complete novice weighing in on what is probably a dumb idea.

While you are running devuan, the wine version shows as Debian. I know I have seen mentioned in the forums countless times, and it held true for me as well, that the versions of wine in our os's repositories are usually way out of date. Since your wine version shows Debian, have you tried following the winehq download instructions for Debian to get a newer version?
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
fargodwe wrote: Sat Feb 27, 2021 9:12 pm jkfloris is the expert ...
No problem whatsoever ...
fargodwe wrote: Sat Feb 27, 2021 9:12 pm ... running devuan, the wine version shows as Debian.
As you surely know, Devuan is Debian without Poettering's systemd.
Devuan uses packages from the Debian repositories and those packages that require systemd are tweaked so as to be able to run in Devuan without issues and those that cannot are not admitted to the repository.
fargodwe wrote: Sat Feb 27, 2021 9:12 pm ... wine in our os's repositories are usually way out of date.
Not only wine.

I have tried quite a few distributions (including Debian) before settling on Devuan.

A coupĺe of them were rolling, ie: "the latest versions of everything" type.
As I had no need to be on a testing platform if I am not testing, I finally settled on Debian because of their developer's "ready when ready" approach to things.

But then systemd came along and I moved to Devuan.
fargodwe wrote: Sat Feb 27, 2021 9:12 pm ... tried following the winehq download instructions for Debian ...
No.

I use wine for two MS based applications I have used for ~ 25 years: IrfanView and Pegasus Mail.
As I found no matching Linux applications to replace them, being able to use them (mostly PMail) under Linux was a deal-breaker that allowed me to finally leave the MS environment.

IrfanView worked well till this happened some time ago but as I had no time to devote to it I just went to File -> Open or dragged the file into the IrfanView window.

But it seems it is an issue either with IrfanView or wine (or the combination of both).

From https://fitzcarraldoblog.wordpress.com/ ... -in-linux/
fitzcarraldoblog wrote: The usual method of setting file associations in Linux does not work for IrfanView. For example, if you use KDE’s Kickoff > System Settings > File Associations to associate JPG files with IrfanView, IrfanView will indeed launch if you double-click on a JPG file, but you’ll be left staring at an empty IrfanView window, as if you had simply launched IrfanView directly.
I still have to try the solution posted in that web page.

Thank you for your input.

V.
fargodwe

Re: MS application on Wine will not open its files

Post by fargodwe »

.
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
fargodwe wrote: Sun Feb 28, 2021 7:40 am .
OK.

This* seems to work:

1. create a file irl.sh in your ~/ folder

Code: Select all

#!/bin/bash
echo "start..." > /tmp/irl.log
F="z:"${1//\//\\}
echo "F=$F" >> /tmp/irl.log
wine "/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/i_view32.exe" $F
a) The two echo lines are for temporary debugging, they will log what is going on to /tmp/irl.log and can be removed (or not) afterwards.

b) It is critical that the path (part between quotes in the last line) is the path to the IrfanView executable in your system and when executed in a terminal actually opens an empty IrfanView instance on the desktop.

If not, check the path for mistakes (typing, extra spaces, bad returns, etc.) and try again.

2. Make the script executable.
3. Create a irfanview_launcher.desktop.desktop file in ~/.local/share/applications/ :

Code: Select all

[Desktop Entry]
Version=1.0
Name=irfanView Launcher
Comment=File Viewer
Exec=/home/user/ir.sh %F
Icon=gtk-image
StartupNotify=true
Terminal=false
Type=Application
Categories=GTK;Graphics;Viewer;
GenericName=IrfanView
MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;application/postscript;image/png;image/x-icon;image/x-xpixmap;image/x-exr;image/x-webp;image/heif;image/heic;image/svg+xml;application/pdf;image/x-wmf;image/jp2;image/x-xcursor;
a) the Exec= line should be the path to the previously created executable script (irl.sh) in your system.
b) the Icon= line should be the path to a 32*32 irfanview icon in your system. eg: in your /home folder

When this is done, right-click on a graphics file on the desktop or Thunar and do:

Properties -> Open With -> and select "irfanView Launcher.desktop" and check off the make it default option.

Do not select "IrfanView x.xx" which will not work, make sure you select the created launcher.
If it is not in the list, select "Other Application" at the end of the list and find it there.

Reboot or restart the desktop to ake sure these settings take effect.

What I do not understand is why this has to be done in this manner.
Any other way?

* NB:
The solution I am posting here originates in the link to the blog I posted previously plus additional elements from these other ones:

https://forum.xfce.org/viewtopic.php?id=13061
https://forum.xfce.org/viewtopic.php?id=14753

Thanks for your input.

Cheers,

V.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: MS application on Wine will not open its files

Post by jkfloris »

Does the following solution work?
Create the file iview.desktop in ~/.local/share/applications
with the following content:

Code: Select all

[Desktop Entry]
Name=Wine IrfanView
Path=/home/<username>/.wine/drive_c/Program Files/IrfanView
Exec=sh -c "wine i_view64.exe \\$(winepath -w %u)"
Type=Application
StartupNotify=true
Modify the Path line to your situation
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
jkfloris wrote: Sun Feb 28, 2021 10:24 am Does the following solution work?
Yes, it does. 8^D

But with a noticeable 2-3 second delay from 'click' to IrfanView open with the file, something which does not happen with the previous solution which opened the application faster.

Thinking that it could be due to some missing parts to the *.desktop file, I completed it:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Wine IrfanView
Comment=File Viewer
Path=/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/
Icon=/home/groucho/i_view.jpg
Exec=sh -c "wine i_view32.exe \\$(winepath -w %u)"
Type=Application
StartupNotify=true
Terminal=false
Type=Application
Categories=GTK;Graphics;Viewer;
GenericName=IrfanView
MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;application/postscript;image/png;image/x-icon;image/x-xpixmap;image/x-exr;image/x-webp;image/heif;image/heic;image/svg+xml;application/pdf;image/x-wmf;image/jp2;image/x-xcursor;
Name[en_GB]=Wine_IrfanView.desktop
The delay is still there, I guess I could learn to live with it.
But makes me wonder why it is there.

Thanks a lot for your input.

Cheers,

V.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: MS application on Wine will not open its files

Post by Bob Wya »

vine wrote: Sun Feb 28, 2021 10:54 am ...

But with a noticeable 2-3 second delay from 'click' to IrfanView open with the file, something which does not happen with the previous solution which opened the application faster.

Thinking that it could be due to some missing parts to the *.desktop file, I completed it:

...

The delay is still there, I guess I could learn to live with it.
But makes me wonder why it is there.

Thanks a lot for your input.

Cheers,

V.
@vine

Try:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Wine IrfanView
Comment=File Viewer
Path=/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/
Icon=/home/groucho/i_view.jpg
Exec=sh -c "WINEDEBUG=-all wine i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
Type=Application
StartupNotify=true
Terminal=false
Type=Application
Categories=GTK;Graphics;Viewer;
GenericName=IrfanView
MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;application/postscript;image/png;image/x-icon;image/x-xpixmap;image/x-exr;image/x-webp;image/heif;image/heic;image/svg+xml;application/pdf;image/x-wmf;image/jp2;image/x-xcursor;
Name[en_GB]=Wine_IrfanView.desktop
There is a small delay - introduced with Wine's default WINEDEBUG terminal output.

Also you can try running your WINEPREFIX wineserver persistently, by autostarting this script:

Code: Select all

#!/usr/bin/env bash

/usr/bin/wineserver -fp
under your Wine user's X Session.

Bob
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
Bob Wya wrote: Sun Feb 28, 2021 4:00 pm Try:

Code: Select all

[Desktop Entry]
--- snip ---
Exec=sh -c "WINEDEBUG=-all wine i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
--- snip ---
Right.
I replaced the Exec= line with the one you provided above.
Bob Wya wrote: Sun Feb 28, 2021 4:00 pm There is a small delay - introduced with Wine's default WINEDEBUG terminal output.
Yes.
But no terminal output.
So I ran the Exec= line on the terminal and got this:

Code: Select all

groucho@devuan:~$ sh -c "WINEDEBUG=-all wine i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
wine: cannot find L"C:\\windows\\system32\\i_view32.exe"
groucho@devuan:~$ 
It is here:

Code: Select all

groucho@devuan:~$ locate i_view32.exe
/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/i_view32.exe
groucho@devuan:~$ 
Bob Wya wrote: Sun Feb 28, 2021 4:00 pm Also you can try running your WINEPREFIX wineserver persistently ...
I've never used wineprefix or wineserver, I recall trying but giving up.
It was a few years ago so details are rather cloudy. =^7

Thanks for your input.

Cheers,

V.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: MS application on Wine will not open its files

Post by Bob Wya »

vine wrote: Sun Feb 28, 2021 5:22 pm ...

Yes.
But no terminal output.
So I ran the Exec= line on the terminal and got this:

Code: Select all

groucho@devuan:~$ sh -c "WINEDEBUG=-all wine i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
wine: cannot find L"C:\\windows\\system32\\i_view32.exe"
groucho@devuan:~$ 
It is here:

Code: Select all

groucho@devuan:~$ locate i_view32.exe
/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/i_view32.exe
groucho@devuan:~$ 
...

OK, so that should be:

Code: Select all

sh -c "WINEDEBUG=-all wine start C:\\Program Files (x86)\\IrfanView\\i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
(I think ... I always hating dealing with backslash escape sequences!)

Bob
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello:
Bob Wya wrote: Mon Mar 01, 2021 7:08 am
vine wrote: Sun Feb 28, 2021 5:22 pm It is here:

Code: Select all

groucho@devuan:~$ locate i_view32.exe
/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/i_view32.exe
groucho@devuan:~$ 
Bob Wya wrote: Mon Mar 01, 2021 7:08 am OK, so that should be:

Code: Select all

sh -c "WINEDEBUG=-all wine start C:\\Program Files (x86)\\IrfanView\\i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
I'm sorry but it does not work.
With this version IrfanView will not even open.

I get the twirly Linux version of "working on it" for about 30/40 seconds and then it gives up.

Unfortunately I have not been able to find anything in the system's log files.

Many thanks for your efforts.

Cheers,

V.
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello again:
vine wrote: Mon Mar 01, 2021 11:15 am I'm sorry but it does not work.
With this version IrfanView will not even open.
So I went to ...

Code: Select all

/home/groucho/.local/share/applications/
... and edited the Wine IrfanView.desktop file back to the first/original version you provided me with.
ie: the version with the 2-3s. lag.

Just in case, here it is:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Wine IrfanView
Comment=File Viewer
Path=/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/
Icon=/home/groucho/i_view.jpg
Exec=sh -c "wine i_view32.exe \\$(winepath -w %u)"
# Exec=sh -c "WINEDEBUG=-all wine start C:\\Program Files (x86)\\IrfanView\\i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
Type=Application
StartupNotify=true
Terminal=false
Type=Application
Categories=GTK;Graphics;Viewer;
GenericName=IrfanView
MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;application/postscript;image/png;image/x-icon;image/x-xpixmap;image/x-exr;image/x-webp;image/heif;image/heic;image/svg+xml;application/pdf;image/x-wmf;image/jp2;image/x-xcursor;
Name[en_GB]=Wine_IrfanView.desktop
All I did was to change the position of the hash, nothing else.
ie: comment the non-working version of the Exec= line instead of the version with the 2-3s. lag, which had been commented to debug it.

---> To make it short: the lag is no more.

That is the only thing I changed.
Any idea as to what is going on?

Cheers,

V.
vine
Level 2
Level 2
Posts: 21
Joined: Wed Jun 07, 2017 7:36 pm

Re: MS application on Wine will not open its files

Post by vine »

Hello again:
vine wrote: Mon Mar 01, 2021 11:31 am ---> To make it short: the lag is no more.
After some house cleaning the original problem came back again.
I went back to check and checked and it turned out I had accidentally deleted a *.desktop file.

So I recovered the last version (in ~/.local/share/applications) from a backup:

Code: Select all

[Desktop Entry]
 2 Version=1.0
 3 Name=Wine_IrfanView
 4 Comment=File Viewer
 5 Path=/home/groucho/.wine/drive_c/Program Files (x86)/IrfanView/
 6 Icon=/home/groucho/i_view.jpg
 7 
 8 Exec=sh -c "wine i_view32.exe \\$(winepath -w %u)"
 9 
10 # Exec=sh -c "WINEDEBUG=-all wine i_view32.exe \\$(WINEDEBUG=-all winepath -w %u)"
11 
12 Type=Application
13 StartupNotify=true
14 Terminal=false
15 Type=Application
16 Categories=GTK;Graphics;Viewer;
17 GenericName=IrfanView
18 MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-$
19 Name[en_GB]=Wine_IrfanView.desktop
The lag I referred to earlier was still there but while looking through IrfanView's settings (Options -> Properties/Sttings -> Miscellaneous), I saw that one of the "Set external editors" fields (the third one) had the path to IrfanView set, the other two being empty.

I did not recall doing that nor do I use an external editor as my quick-go-to editor for basic tasks (resize, resample, crop, rotate, etc.) is IrfanView.

So I removed that setting and as a result, there is no longer any lag when I click on an image file, so that got solved once and for all.

Unfortunately, I found a new and previously unnoticed problem while cleaning up old files and duplicates:

I can open a file on my desktop by clicking on it and IrfanView will open up and show the file.

But ...

If I open the my file manager application (any folder) and do the same, IrfanView will open up but show no image, with the legend No file loaded (use File -> Open menu) like when I first posted.

If I copy the file to the desktop, it opens as it should.

Any idea as to what is happening here?

Thanks in advance,

V.
Locked