Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-09-11 08:35:07

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

[Solved] Defining Default Applications for Links

Hello,

I would like to know if the behavior i'm observing is normal, or if there is anything I can do to solve it "the XFCE way".
Basically, I'm using Chrome as my web browser (corporate reasons), and I noticed that links with an application scheme protocol are not handled correctly. Links prefixed with mailto: or with magnet: just open a new empty Chrome window, instead of starting my associated program.

However, those links are correctly working with Firefox.

Any pointer please?

Thank you for your help!
Doodloo.

Offline

#2 2015-09-11 11:14:12

Jerry3904
Member
Registered: 2013-11-09
Posts: 853

Re: [Solved] Defining Default Applications for Links

Not a Chrome user, so only ask: did you try a web search on "chrome set mailto"? Seems to be a lot there.


MX-23 (based on Debian Stable) with our flagship Xfce 4.18.

Offline

#3 2015-09-11 13:00:40

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,028

Re: [Solved] Defining Default Applications for Links

Which distro and which version of Xfce are you using?

I'm aware of an issue with Chrome and the xdg-utils package shipped with the Xubuntu distro where the Xfce detection method doesn't work (related bug report). If you look at the /usr/bin/xdg-email and /usr/bin/xdg-open files, Xfce is being detected via the following conmand:

elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;

...but on my xubuntu install, that command doesn't return anything. The workaround is to manually edit those two files to fix Xfce detection.

My arch system does properly return "xfce4" with that command, but the arch xdg-utils package is based on a specific commit that changes the DE detection method.

EDIT: Also this thread.

Last edited by ToZ (2015-09-11 13:06:49)


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#4 2015-09-11 17:58:57

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Defining Default Applications for Links

Hello Jerry and ToZ,

Jerry3904 wrote:

Not a Chrome user, so only ask: did you try a web search on "chrome set mailto"? Seems to be a lot there.

Unfortunatelly, that's the first thing i tried. Basically, the Chrome and Chromium "handlers" panes are completely empty, and there is absolutely no way to add any. But i don't think it is relevant to the problem, the default behavior of the web browser is to fall back to operating system registered applications when no internal handler is defined, which is not happening.

ToZ wrote:

Which distro and which version of Xfce are you using?

Xubuntu 15.04 / XFCE 4.12 on amd64.

Now, i'm trying to run the base command before it gets grepped:

$: xprop -root _DT_SAVE_MODE
_DT_SAVE_MODE:  not found.

Sounds like someone didn't do regression tests on this file before releasing 4.12 wink

Thanks a lot guys! I will try to figure a way with the possible workarounds you suggested.

[edit]
Now that i think about it, i also had to edit a script i found on the net to replace my WM with compiz and then when started again replace it with the default DE WM... And the XFCE detection part didn't work as well, i had to rewrite it. To do so, i replaced the test with another test, looking into the environment variable $UPSTART_JOB, which as i was looking for my env was equal to "startxfce4"... Maybe not the best option but it worked for me.
[/edit]

Doodloo.

Last edited by doodloo (2015-09-11 18:03:22)

Offline

#5 2015-09-11 18:11:38

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Defining Default Applications for Links

Hello again,

So the solution for me was to change the files as pointed out by ToZ. Here is how to do it:

You have to vi two files with root.

The first one is /usr/bin/xdg-email, you want to look for the function named "detectDE" (In my distro it was around line 375).
In this function, you will have to change the XFCE test which looks like this:

elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;

To something that returns true on XFCE4. I am using this:

elif [ "$UPSTART_JOB" = "startxfce4" ]; then DE=xfce;

The second file is /usr/bin/xdg-open, and it's exactly the same process.

However, i choose to not edit those files directly, because i feel like they might be overwritten by any upgrade of the related packages.
Instead, i would recommend that you have that in scripts named equally, but put at some place that has precedence over your $PATH. I choose $HOME/.local/bin.

To do that, i changed my /etc/environment file so it includes $HOME/.local/bin prior to anything else in $PATH. Eg:

PATH="$HOME/.local/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

If you choose this path, you will have to logout / login back to XFCE for the environment to be re-applied to your DE session.

To be sure that your script will be used instead of the distro's one, you can issue the following command:

which xdg-open && which xdg-email

The result should be pointing to the file that has precedence (Eg the one you just created in your home). This solution has the disadvantage of being required on every user of your system (Also if you plan to use an application as root, you will need to do the same for the root user), but will be resilient to system upgrades and disasters like "forgetting about the issue after reinstalling".

Hope it will also help someone wink
Doodloo.

Last edited by doodloo (2015-09-11 18:24:37)

Offline

Board footer

Powered by FluxBB