Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-03-13 12:12:24

jt1122
Member
Registered: 2021-03-26
Posts: 103

Opening links in different browsers based on url

Hi,

I'm trying to have url links processed by different browsers based on the url, for example:
http://a.com would be opened by chromium
http://b.com would be opened by firefox

I've set xdg-mime to point to a new f.desktop for x-scheme-handler/http and https:
xdg-mime query default x-scheme-handler/http
f.desktop

so f.desktop replaces /usr/share/applications/xfce4-web-browser.desktop:

cat f.desktop
[Desktop Entry]
Version=1.0
Type=Application
Exec=/home/pc/check_url %U
Icon=org.xfce.webbrowser
StartupNotify=true
Terminal=false
Categories=Network;X-XFCE;X-Xfce-Toplevel;
OnlyShowIn=XFCE;
X-XFCE-MimeType=x-scheme-handler/http;x-scheme-handler/https;
X-AppStream-Ignore=True
Name=Web Browser

and in check_url the various checks are done on the url to decide which browser to use.

Opening links from thunderbird works as expected - f.desktop & check_url are executed.

However when I click on a link in the xfce terminal the link simply opens up in the same browser regardless.
In gmail-desktop I get a popup window "Would you like to open the link in the default browser?" .
So in both cases the url handling isn't done with xdg-mime,

How can I have all links (from what ever program) to be handled by xdg (if that's even possible) or is there another way to achieve such url handling?.

Thanks

Offline

Board footer

Powered by FluxBB