I want to open the default mail client from my application to the user can send me an e-mail.
what I did was simply try some of the common browsers (it’s usually is firefox but there is also an option for the user to set another browser in my application) and let it open mailto:email@example.com. This works on most linuxes but not on openSuse.
Firefox tries to use evolution as the default mail-client, even if its not installed (which is the case). There is no error message so nothing happens.
Is there a good way to find a the default mail-client or any that is installed so I can be sure something opens?
In KDE there is also a central place. But FF must be done sep
In my FF I did the following to let FF point to Kmail:
Type about:config in the address bar. You get a long list of parameters. Type* mail* in the Filter bar, this will reduce the list considarable.
I choose network.protocol-handler.app.mailto and set it to kmailservice.
It doesn’t matter what DE I use. I don’t know what the end user will use. Isn’t there some standard way to get those default applications?
There is a DLL on Windows and OS X has its own Java-library. But Linux has nothing?
I’m sure I’m not the only one with this problem. Doesn’t every application at least have a link to the developers website and an e-mail-link?! How do they do that?
AFAIK there is no such standard (though it wouldn’t be a bad idea). That means that every product where this sort of situation may apply makes his own solution. In this case every DE does it centraly, but in its own way. FF does not belong to any of the DEs. So FF “could” try to find out if it is running within a certain DE and then try to find out in that DEs’ special way. But there are many DEs. And IMHO you can not blame FF that it tries to use Mozillas mail program first.
The difference between Linux and the other two OS brands you mention is that they are closed and it is very easy for them to implement an internal standard. Making a real international open standard for anything is not that easy, but it is these standards that Linux depends on.
That is a good question. I assume you mean you want to detect this from a script and not from taking a glance at the screen.
The above $DESKTOP_LAUNCH may do somethiing, but, like you, I do not know if it is an openSUSE only trick or not. Is that script running as root, or as the user? A ps with some nice options and a grep for the user might give a clue. I think for kde when /usr/bin/kde is running for that user you have something. But the user may be logged in several times with different DEs! Looking inside the environment. In my session:
henk@boven:~> env | grep KDE
But you have to search for hints about a user session using Gnome, Xfce, fvwm, …
The user may be stupid, but when he wants something to be run he will choose his own environment. Linux is about choice.
xdg-email would be the standard way but not sure if this is honoured and it doesn’t seem to cover all scenarios, also unsure on the env vars it is picking up. As it works fine on another distro with lxde but on Suse not. It may be a hack as looking at the script it has the main 3(KDE, Gnome, Xfce and generic).
As to whether it works all the time with KDE or gnome the docs imply it should honour the DE mail client choice, but I have neither to test with.
The xdg utils do a lot of DE testing have a look they are bash scripts.
OK on further testing xdg-email will test for the DE if found it will use the default, if no DE(generic) it then will test for the BROWSER env var if not found it will then take a guess at a couple of usual suspects then it will use the mailto configured in that.
i.e evolution the problem I discovered, after setting the mailto to tbird it worked as expected in Suse.
>> AFAIK there is no such standard (though it wouldn’t be a bad idea).
>There is $DESKTOP_LAUNCH on OpenSuse but not on other systems. I think
>i’ll use this if it is set.
>> So FF “could” try to find out if it is running within a certain DE and
>> then try to find out in that DEs’ special way.
>But even for that there is no standard. How do I know on what DE I am?!
You know, there is another way. You could write a java script to
generate an email, the format is really simple. You could even make
it look like your favorite mail program. Then you just link to your
email page. See Jim Thompson’s site for an example.