Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ separately in [CHANGELOG-DEPS.md](CHANGELOG-DEPS.md).

## Unreleased

- **Linux opens JSON and other text files in their associated application.**
File opening and text editing honor the desktop's inherited associations.

- **Going up to a parent folder selects the folder you came from and scrolls
it into view, whichever way you go up.** Backspace and Back already did
this; clicking a breadcrumb segment, a folder in the sidebar tree, or typing
Expand Down
10 changes: 8 additions & 2 deletions crates/ferail-shell-linux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,13 @@ pub fn open_url(_url: &str) {}
/// Ferail's stdio and reaped when the launcher exits.
#[cfg(target_os = "linux")]
pub fn open_with_default(path: &Path) -> std::io::Result<()> {
spawn_detached(std::process::Command::new("xdg-open").arg(path))
let path = std::path::absolute(path)?;
match spawn_detached(std::process::Command::new("gio").arg("open").arg(&path)) {
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
spawn_detached(std::process::Command::new("xdg-open").arg(&path))
}
result => result,
}
}

#[cfg(not(target_os = "linux"))]
Expand All @@ -159,7 +165,7 @@ pub fn open_with_default(_path: &Path) -> std::io::Result<()> {
/// portable equivalent of TextEdit/Notepad.
#[cfg(target_os = "linux")]
pub fn edit_text_file(path: &Path) -> std::io::Result<()> {
spawn_detached(std::process::Command::new("xdg-open").arg(path))
open_with_default(path)
}

#[cfg(not(target_os = "linux"))]
Expand Down