[CentOS] xdgurl

Fri Oct 21 01:27:02 UTC 2016
Mark LaPierre <marklapier at gmail.com>

On 10/20/16 07:06, James Pearson wrote:
> Mark LaPierre wrote:
>> Has anyone figured out how to make Firefox 45.4.0 on CentOS 6 use xdgurl
>> to handle xdg:// URLs?
>>
>> Google is full of suggestions that don't work.  When I select a an
>> xdg:// link I don't get a dialog asking me what to do like Google says I
>> will.  Instead I get a message that says Firefox doesn't have a clue how
>> to handle this URL.  Do you want to try again?
>>
>> I tried about:config
>>
>> I added:
>>
>> network.protocol-handler.external.xdg  user set  string /usr/bin/zdgurl
> 
> I don't think those types of prefs are used any more ?
> 
> A lot of the information out there on adding protocol handlers to
> Firefox on Linux is out of date or wrong ...
> 
> A couple of ways that work for me (on CentOS 6, using Gnome) with
> Firefox 45:
> 
> 1. Create the file $HOME/.local/share/applications/xdg containing
> 
> [Desktop Entry]
> Name=xdg
> Type=Application
> Exec=/usr/bin/xdgurl %U
> Terminal=false
> MimeType=x-scheme-handler/xdg;
> NoDisplay=true
> 
> Then run:
> 
> desktop-file-install $HOME/.local/share/applications/xdgdesktop \
>  --rebuild-mime-info-cache --dir=$HOME/.local/share/applications
> 
> Start firefox and browse to a xdg:// URL - it still prompts for the
> application use the first time - but after that, it should work OK
> 
> Note: I haven't actually done this for an 'xdg' protocol handler - but
> it works for launching other apps using other custom protocol handlers
> 
> 2. Set up a protocol handler in a central autoconfig 'mozilla.cfg' file
> using Javascript - this is the method I use to automatically add a
> protocol handler for all users (and doesn't require any user
> intervention) - let me if you want more details about this method
> 
> James Pearson

Hey James,

Thanks for the detailed response.  Just a minor error.  The file name
must have a .desktop extension like this:

1. Create the file $HOME/.local/share/applications/xdg.desktop containing:

[Desktop Entry]
Name=xdg
Type=Application
Exec=/usr/bin/xdgurl %U
Terminal=false
MimeType=x-scheme-handler/xdg;
NoDisplay=true

Then run:

desktop-file-install $HOME/.local/share/applications/xdg.desktop \
--rebuild-mime-info-cache --dir=$HOME/.local/share/applications

I restarted Firefox then I went to visit:

https://www.gnome-look.org/p/1157815/

I clicked on the [Install] button.

I got the dialog box where I chose the handler /usr/bin/xdgurl

I did not get the install dialog.

In a shell:

[mlapier at peach ~]$ which xdgurl
/usr/bin/xdgurl

[mlapier at peach ~]$ xdgurl
"xdg://install?url=https%3A%2F%2Fdl.opendesktop.org%2Fapi%2Ffiles%2Fdownload%2Fid%2F1476439340%2Frmfixed.bdf&type=fonts&filename=rmfixed.bdf"
Traceback (most recent call last):
  File "/usr/bin/xdgurl", line 21, in <module>
    if sys.version_info.major >= 3:
AttributeError: 'tuple' object has no attribute 'major'
[mlapier at peach ~]$

No joy,

-- 
    _
   °v°
  /(_)\
   ^ ^  Mark LaPierre
Registered Linux user No #267004
https://linuxcounter.net/
****