1

I'm struggling with gio failing to open an url using default browser under XFCE4 desktop environment. What could be the reason and how to fix it?

gio info http://google.com identifies the link as text/html type:

$ gio info http://google.com
display name: /
display name: /
type: regular
uri: http://google.com
attributes:
  standard::type: 1
  standard::display-name: /
  standard::edit-name: /
  standard::icon: text-html, text-x-generic, text-html-symbolic, text-x-generic-symbolic
  standard::content-type: text/html
  standard::fast-content-type: text/html
  standard::symbolic-icon: text-html-symbolic, text-x-generic-symbolic, text-html, text-x-generic
  id::filesystem: http:uri=http%3A%2F%2Fgoogle.com

gio mime text/html reports the correct default browser for the type:

$ gio mime text/html
Default application for “text/html”: sidekick-browser.desktop
Registered applications:
    sidekick-browser.desktop
    calibre-ebook-edit.desktop
    chromium.desktop
    firefox.desktop
    emacs.desktop
    emacsclient.desktop
    okularApplication_txt.desktop
    org.xfce.mousepad.desktop
    vim.desktop
Recommended applications:
    sidekick-browser.desktop
    calibre-ebook-edit.desktop
    chromium.desktop
    firefox.desktop

But gio open http://google.com opens the link in Chromium, which is not a default browser according to gio info.

At the same time, xdg-open opens the link in Sidekick browser which conforms to settings.

krvkir
  • 111

1 Answers1

0

To get a better overview of the call stack you can run:

bash -x xdg-open http://google.com

With this you can pinpoint the actual utility or desktop file that will be used to run your browser.

I am saying this because xdg-open will either pass the URL to another tool or search for a suitable browser binary in desktop entries found in these locations:

$XDG_DATA_HOME:$HOME/.local/share:$XDG_DATA_DIRS:/usr/local/share/:/usr/share/

Worth to note, that all of this also depends on the desktop environment and the applications available on your system.

This is based on research conducted on a Ubuntu 22.04.5 LTS system with xdg-utils 1.1.3-4.1ubuntu3~22.04.1.