Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use xdg-open to spawn browser on GNU/Linux #1265

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

gouttegd
Copy link
Collaborator

This PR updates the NativeBrowserLauncher class so that, on GNU/Linux (or similar non-macOS, non-Windows platforms), we try opening a URL using xdg-open first, before any other possible browser. This ensures that the URL is opened using the user’s preferred browser (assuming a FreeDesktop.org-compliant environment, which should be the case of most if not all GNU/Linux distributions nowadays).

closes #1263

Also bundled with that PR are two small changes on that same NativeBrowserLauncher class to silence some warnings about (1) the use of a “raw type” Class and (2) the use of the deprecated-in-Java-18 java.lang.Runtime.exec(String) method.

On GNU/Linux (or similar, non-macOS, non-Windows platforms), when
attempting to open a URL, try using the `xdg-open` command first, before
any other possible browser. This would ensure that the link is open
using the user's preferred browser (assuming a FreeDesktop.org-compliant
desktop environment).

closes #1263
Silence some warnings in the NativeBrowserLauncher by:

* avoiding using a "raw type" `Class`;
* avoiding the single-argument form of `java.lang.Runtime.exec`
  (deprecated in Java18).
@gouttegd gouttegd self-assigned this Feb 24, 2025
@gouttegd gouttegd merged commit f6d053a into master Feb 24, 2025
3 checks passed
@gouttegd gouttegd deleted the use-xdg-open-to-spawn-browser branch February 24, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use xdg-open for opening links on Linux
1 participant