13
  • kde-open "http://askubuntu.com/" is nice, and opens the URL in my webbrowser
  • but xdg-open "http://askubuntu.com/" opens the link in my texteditor :-(

I know where I find the file-association in KUbuntu, but as kde-open works, I guess thats not where the problem is.

Can I sync xdg-open to use the same program as the kde-open?
Or at least change its behavior for http(s)-URLs?

(The main problem is that some programs, like the slack-client, uses xdg-open to open files and URLs.)

Update 1

x-www-browser and gnome-www-browser in update-alternatives:

update-alternatives --display x-www-browser
x-www-browser - auto mode
  link best version is /usr/bin/firefox
  link currently points to /usr/bin/firefox
  link x-www-browser is /usr/bin/x-www-browser
  slave x-www-browser.1.gz is /usr/share/man/man1/x-www-browser.1.gz
/usr/bin/chromium-browser - priority 40
/usr/bin/firefox - priority 40
/usr/bin/konqueror - priority 30
  slave x-www-browser.1.gz: /usr/share/man/man1/konqueror.1.gz

and gnome-www-browser

update-alternatives --display gnome-www-browser
gnome-www-browser - auto mode
  link best version is /usr/bin/firefox
  link currently points to /usr/bin/firefox
  link gnome-www-browser is /usr/bin/gnome-www-browser
/usr/bin/chromium-browser - priority 40
/usr/bin/firefox - priority 40

Both point to firefox, no trace of kwrite.

user.dz
  • 48,105
Puggan Se
  • 948
  • 1
  • 10
  • 19
  • The following post might contain helful informations for you: http://askubuntu.com/questions/18418/how-to-set-which-application-is-launched-by-xdg-open – dufte Jun 17 '16 at 07:19
  • @dufte as both x-www-browser and gnome-www-browser points to firefox, it wasn't that helpful :-( but thanks anyway – Puggan Se Jun 17 '16 at 09:01

1 Answers1

14

It looks like xdg-open has internal settings at least I could make it open different browser than the one set within update-alternatives.

$ xdg-settings --list
Known properties:
  default-url-scheme-handler    Default handler for URL scheme
  default-web-browser           Default web browser

$ xdg-settings get default-web-browser
chromium.desktop

$ update-alternatives --display x-www-browser
x-www-browser - auto mode
  link best version is /usr/bin/firefox
  link currently points to /usr/bin/firefox
  link x-www-browser is /usr/bin/x-www-browser
/usr/bin/chromium-browser - priority 40
/usr/bin/firefox - priority 40

To fix that:

xdg-settings set default-web-browser firefox.desktop

Verify:

$ xdg-settings get default-web-browser
firefox.desktop
$ xdg-open "http://askubuntu.com/"
[opens firefox now]
user.dz
  • 48,105
  • 2
    xdg-settings get default-web-browser gives org.kde.kwrite.desktop – Puggan Se Jun 20 '16 at 13:06
  • this answer is indeed helpful, but i get the same as @PugganSe even after i run xdg-settings set default-web-browser firefox.desktop... – Jayen Dec 19 '18 at 09:12
  • 2½ year ago, but I have a vage memory of things sorting out after installing nautilus. By installing nautilus in KDE, the gnome and kde defualt-app settings got glued togheter, and my kde-settings started to work. Don't remember if that solved this issue, or if it wan another issue in gentoo. – Puggan Se Dec 19 '18 at 22:17
  • 4
    Things depend on how the web browser is called by the other program. If the environment calls an URL, you may want to additionally set the default-url-scheme-handler for 'http', 'ftp' (also 'mailto' would be possible), like in xdg-settings set default-url-scheme-handler http firefox.desktop or xdg-settings set default-url-scheme-handler ftp firefox.desktop (or xdg-settings set default-url-scheme-handler mailto claws-mail.desktop for Claws as default 'mailto:'-link program) – Jaleks Jul 07 '19 at 12:49