From b135a64c3f575843128e3ec6f592b38b0e3c0403 Mon Sep 17 00:00:00 2001 From: ooonea <35407790+ooonea@users.noreply.github.com> Date: Sat, 31 Oct 2026 23:29:48 +0100 Subject: [PATCH 1/2] fix(linux): open folders from the desktop Apply the existing --navigate argument to ordinary windows and advertise directory handling in the Linux desktop entry. Assisted-by: OpenAI Codex --- CHANGELOG.md | 3 +++ crates/ferail-gpui/resources/linux/ferail.desktop | 8 ++------ crates/ferail-gpui/src/boot.rs | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e362c3d..63ddb302 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ separately in [CHANGELOG-DEPS.md](CHANGELOG-DEPS.md). ## Unreleased +- **Linux desktops can open folders in Ferail.** The desktop entry handles + directory paths through `--navigate`, which now also applies to normal windows. + - **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 diff --git a/crates/ferail-gpui/resources/linux/ferail.desktop b/crates/ferail-gpui/resources/linux/ferail.desktop index 41463f4b..49979b4d 100644 --- a/crates/ferail-gpui/resources/linux/ferail.desktop +++ b/crates/ferail-gpui/resources/linux/ferail.desktop @@ -6,17 +6,13 @@ # to "ferail" (see ferail-gpui/src/lib.rs base_window_options). Rename # this file and the taskbar icon/grouping silently breaks. # -# No %F/%U field code on Exec yet: the binary treats a bare positional -# argument as an unknown subcommand (src/main.rs handle_cli_subcommand), -# so it cannot open a directory passed by the desktop shell. Add -# MimeType=inode/directory; and Exec=ferail %U once a path argument is -# supported. [Desktop Entry] Type=Application Name=Ferail GenericName=File Manager Comment=Fast file manager with disk usage, previews, and dual-pane browsing -Exec=ferail +Exec=ferail --navigate %f +MimeType=inode/directory; Icon=ferail Terminal=false Categories=System;FileTools;FileManager; diff --git a/crates/ferail-gpui/src/boot.rs b/crates/ferail-gpui/src/boot.rs index f67a6e34..584f2229 100644 --- a/crates/ferail-gpui/src/boot.rs +++ b/crates/ferail-gpui/src/boot.rs @@ -165,6 +165,7 @@ pub fn run_gui(args: screenshot::Args) { let theme_mode = args.theme; let settings_page = args.settings; let initial_archive = args.archive; + let initial_directory = args.navigate.last().cloned(); app.run(move |cx| { // Arm the Prime Directive's debug-build tripwire: from here on, @@ -467,7 +468,12 @@ pub fn run_gui(args: screenshot::Args) { let initial_size = (width, height); cx.spawn(async move |cx| { cx.update(|cx| { - open_shell_window_sized(cx, Some(initial_size), initial_archive); + open_shell_window_sized( + cx, + Some(initial_size), + initial_archive, + initial_directory, + ); }); }) .detach(); @@ -496,7 +502,7 @@ fn settings_window_opts(width: f32, height: f32) -> WindowOptions { /// route through this so there's one place that owns window options /// and process-state hookup. pub fn open_shell_window(cx: &mut App) { - open_shell_window_sized(cx, None, None); + open_shell_window_sized(cx, None, None, None); } #[cfg(feature = "screenshot-harness")] @@ -636,6 +642,7 @@ fn open_shell_window_sized( cx: &mut App, size_hint: Option<(f32, f32)>, initial_archive: Option, + initial_directory: Option, ) { let (w, h) = size_hint.unwrap_or((1180.0, 760.0)); let opts = WindowOptions { @@ -654,6 +661,9 @@ fn open_shell_window_sized( install_dev_window_callback_cleanup(window, cx); let process = crate::process_state::process_state(cx); let view = cx.new(|cx| Shell::new(process, window, cx)); + if let Some(directory) = initial_directory.clone() { + view.update(cx, |shell, cx| shell.navigate(directory, cx)); + } if let Some(archive) = initial_archive.clone() { view.update(cx, |shell, cx| { shell.open_archive_path(archive, window, cx); From 2ac77e1bbd6e142309eb2f35788196329107cd41 Mon Sep 17 00:00:00 2001 From: ooonea Date: Sun, 1 Nov 2026 20:14:51 +0100 Subject: [PATCH 2/2] boot: normalize the initial navigation directory Assisted-by: OpenAI Codex --- crates/ferail-gpui/src/boot.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ferail-gpui/src/boot.rs b/crates/ferail-gpui/src/boot.rs index 584f2229..a709c6ff 100644 --- a/crates/ferail-gpui/src/boot.rs +++ b/crates/ferail-gpui/src/boot.rs @@ -165,7 +165,11 @@ pub fn run_gui(args: screenshot::Args) { let theme_mode = args.theme; let settings_page = args.settings; let initial_archive = args.archive; - let initial_directory = args.navigate.last().cloned(); + let initial_directory = args + .navigate + .last() + .cloned() + .map(crate::shell::canonicalize_for_identity); app.run(move |cx| { // Arm the Prime Directive's debug-build tripwire: from here on,