#launch #start #xdg-open

bin+lib open

Open a path or URL using the program configured on the system

47 stable releases (4 major)

5.3.2 Jan 5, 2025
5.3.1 Nov 14, 2024
5.3.0 Jul 10, 2024
5.1.2 Mar 7, 2024
1.0.2 Feb 28, 2015

#11 in Filesystem

Download history 99117/week @ 2024-10-09 103495/week @ 2024-10-16 99478/week @ 2024-10-23 98886/week @ 2024-10-30 94931/week @ 2024-11-06 103481/week @ 2024-11-13 101786/week @ 2024-11-20 102230/week @ 2024-11-27 107824/week @ 2024-12-04 112564/week @ 2024-12-11 96101/week @ 2024-12-18 68896/week @ 2024-12-25 96611/week @ 2025-01-01 119828/week @ 2025-01-08 117024/week @ 2025-01-15 109413/week @ 2025-01-22

452,963 downloads per month
Used in 520 crates (395 directly)

MIT license

28KB
481 lines

Crates.io cross-platform-testing

Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:

# macOS
$ open <path-or-url>
# Windows
$ start <path-or-url>
# Linux
$ xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url> || wslview <path-or-url>

Library Usage

Add this to your Cargo.toml

[dependencies]
open = "5"

…and open something using…

open::that("https://rust-lang.org");

…or, open something with an application of your choice

open::with("https://rust-lang.org", "firefox");

Follow this link for the API docs.

Binary Usage

This crate also implements a binary that acts like an opener itself.

cargo run 'file to open'

Credits

The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.

Dependencies

~57KB