Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 16 Mar 2015

      Open URL Bug with XDG on XFCE4

      Written by Alex Wood

      Recently I noticed that in my IRC client, when I right-click a URL and select “Open Link In Browser”, the system would open a new browser window (or tab if appropriate) but not pointed to the link I wanted to visit. It would just open the home page.

      What gives? Well, I happen to know from experience that in Linux most programs that need to use a “default” type service of which there are many implementations (such as a web-browser) use the xdg-open command. XDG associates different mime-types to default applications. Step one then is to figure out what’s going on with XDG.

      
      % xdg-mime query default text/html
      firefox.desktop firefox.desktop
      

      Here I’m asking XDG what applications are associated with the text/html mime-type. Seeing two firefox.desktop files was a bit of a surprise. Let’s find out more!

      
      % locate firefox.desktop
      /usr/share/applications/firefox.desktop
      /usr/share/xfce4/helpers/firefox.desktop
      

      So I open up those two files and the first file looks normal and that file actually belongs to the Firefox package according to rpm -qf. In the second file, I see

      
      X-XFCE-Commands=%B -remote "openURL(about:blank,new-window)";%B;
      X-XFCE-CommandsWithParameter=%B -remote "openURL(%s,new-window)";%B "%s";
      

      That looks strange to me. If I want to open a URL from the command line, I don’t use openURL. Let’s see what happens if I replace that with

      
      X-XFCE-Commands=%B;
      X-XFCE-CommandsWithParameter=%B "%s";
      

      Aha! It works! But why? Well, after a little searching I came across Mozilla Bug 1080319. Looks like the openURL was a legacy thing and got removed in Firefox 36. And a quick rpm -q firefox confirms that I’m running that version. Firefox 36.0.1 add support for openURL back in, but my hack will serve until that version hits Fedora.

      • Tags »

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Querying block device sizes in Python on Linux and Mac OS X February 4, 2023
      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa
      • Issue Comment
        bitmath
        February 6, 2023 - 12:55 am UTC
      • Issue Comment
        bitmath
        February 6, 2023 - 12:54 am UTC
      • Push
        bitmath
        February 6, 2023 - 12:51 am UTC
      • Issue Comment
        bitmath
        February 6, 2023 - 12:36 am UTC
      • Push
        bitmath
        February 6, 2023 - 12:30 am UTC

Creative Commons License
Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.