Seeker14491 / opener

Open a file or link in the system default program.
Apache License 2.0
49 stars 10 forks source link

0.4 doesn't seem to use either BROWSER or the default-browser from XDG. #9

Closed sudoforge closed 2 years ago

sudoforge commented 2 years ago

rustup-doc version 1.24.3 (the current latest available version as of the filing of this issue) uses opener = "0.4.0", and neither the BROWSER environment variable nor the XDG default-browser property appear to be used to open the browser. Following the discussion in https://github.com/rust-lang/rustup/issues/2642, it appears that support for the BROWSER environment variable isn't available with that version of opener. Looking at the 0.4.1 tag in this repository (and based on the discussion in the aforementioned issue), it appears that xdg-open should be used to open the URL. This doesn't seem to be the case.

➜ echo $BROWSER
qutebrowser

➜ xdg-settings get default-web-browser
org.qutebrowser.qutebrowser.desktop

➜ rustup doc &
[1] 918976

➜ pstree 918976
rustup───sh───chromium─┬─chromium───chromium───19*[{chromium}]
                       ├─chromium───chromium─┬─chromium───5*[{chromium}]
                       │                     └─2*[chromium───12*[{chromium}]]
                       ├─chromium───7*[{chromium}]
                       └─19*[{chromium}]
Seeker14491 commented 2 years ago

Version 0.4 on Linux exclusively uses the xdg-open script bundled with the library to open links. If it's opening an unexpected program, the problem lies in that script. The script comes straight from xdg-utils, and I don't intend on making modifications to that script, except updating it with upstream changes.

I can only recommend using v0.5, which explicitly supports the BROWSER environment variable, and also uses the system xdg-open if available.

sudoforge commented 2 years ago

To any future readers, this was due to the xdg-mime configuration for text/html being set to chromium.desktop. To resolve this:

xdg-mime default <your preferred application> text/html