Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

The classic Windows menu has Send with Ferry (1074)

gelenmedya7f52936c8218
diff --git a/crates/rf-app/src/ferry.rs b/crates/rf-app/src/ferry.rs
index 94cb05e4..4041349f 100644
--- a/crates/rf-app/src/ferry.rs
+++ b/crates/rf-app/src/ferry.rs
@@ -829,7 +829,12 @@ pub(crate) fn open_settings(cx: &mut App) {
crate::workspace::show_settings(cx);
}
-fn send(peer: &Peer, paths: Vec<PathBuf>, cx: &mut App) {
+/// The devices seen nearby right now, for the classic menu's second menu (`FolderView::ferry_menu`).
+pub(crate) fn peers(cx: &App) -> Vec<Peer> {
+ cx.try_global::<Ferry>().map(|f| f.peers.clone()).unwrap_or_default()
+}
+
+pub(crate) fn send(peer: &Peer, paths: Vec<PathBuf>, cx: &mut App) {
let Some(n) = cx.global::<Ferry>().nearby.clone() else { return };
match n.send(peer.id.clone(), paths.iter().map(|p| p.to_string_lossy().into_owned()).collect()) {
Ok(transfer) => track(cx, transfer, format!("{}: {}", t!("Ferry ile gönderiliyor"), peer.name), None),
diff --git a/crates/rf-app/src/ops.rs b/crates/rf-app/src/ops.rs
index c2444b61..30f61ec7 100644
--- a/crates/rf-app/src/ops.rs
+++ b/crates/rf-app/src/ops.rs
@@ -39,6 +39,9 @@ const MENU_EXTRACT_SMART: u32 = 21;
const MENU_EXTRACT_PICK: u32 = 22;
const MENU_TERMINAL_ADMIN: u32 = 23;
const MENU_HYPERDOWNLOAD: u32 = 24;
+const MENU_FERRY: u32 = 25;
+/// The rows of the classic menu's second menu for Ferry: a device nearby each, then the settings.
+const MENU_FERRY_BASE: u32 = 10_000;
/// Whether one of our own rows in the classic menu ([`FolderView::show_native_menu`]) is shown under Settings › Context menu, by
/// the same switches as in our right-click menu (`ctx_menu`): issue 620, with "Always the classic Windows menu" on the rows switched
@@ -1177,6 +1180,11 @@ impl FolderView {
v.push(item(MENU_7Z, t!("7z olarak sıkıştır")));
v.push(item(MENU_TAGS, t!("Etiketle…")));
v.push(item(MENU_SHELF, t!("Rafa ekle\tCtrl+Shift+S")));
+ // as in our own menu, where it is a submenu (issue 1074: "Send with Ferry" was missing with "Always the classic
+ // Windows menu" on); here it opens a second menu with the devices, as "Tag…" does
+ if crate::ferry::running(cx) && !items.iter().any(|p| crate::archive_view::split(p).is_some() && !p.exists()) {
+ v.push(item(MENU_FERRY, t!("Ferry ile gönder")));
+ }
if self.dual {
if single_dir {
v.push(item(MENU_OTHER_OPEN, t!("Diğer panelde aç")));
@@ -1282,6 +1290,7 @@ impl FolderView {
}
}
MenuOutcome::Custom(MENU_TAGS) => v.tag_menu(tag_items.clone(), cx),
+ MenuOutcome::Custom(MENU_FERRY) => v.ferry_menu(tag_items.clone(), cx),
MenuOutcome::Custom(MENU_SHELF) => cx.emit(crate::folder_view::FolderEvent::AddToShelf(tag_items.clone())),
MenuOutcome::Custom(MENU_OTHER_OPEN) => {
cx.emit(crate::folder_view::FolderEvent::OpenInOtherPane(rf_core::Location::Path(target_dir.clone())))
@@ -1479,6 +1488,37 @@ impl FolderView {
.detach();
}
+ /// Second popup of the classic menu's "Send with Ferry": the devices nearby, and Ferry's settings (issue 1074).
+ pub fn ferry_menu(&mut self, paths: Vec<PathBuf>, cx: &mut Context<Self>) {
+ let peers = crate::ferry::peers(cx);
+ let mut items: Vec<ExtraItem> = peers.iter().enumerate().map(|(i, p)| ExtraItem { id: MENU_FERRY_BASE + i as u32, label: p.name.clone(), enabled: true }).collect();
+ if items.is_empty() {
+ items.push(ExtraItem { id: MENU_FERRY_BASE - 1, label: t!("Yakında cihaz yok").to_string(), enabled: false });
+ }
+ let settings_id = MENU_FERRY_BASE + peers.len() as u32;
+ items.push(ExtraItem { id: settings_id, label: t!("Ferry ayarları…").to_string(), enabled: true });
+ let (tx, rx) = oneshot::channel::<Option<u32>>();
+ rf_win::sta::run(move |owner| {
+ let mut pt = POINT::default();
+ unsafe {
+ let _ = GetCursorPos(&mut pt);
+ }
+ let _ = tx.send(rf_win::ctxmenu::show_simple(owner, (pt.x, pt.y), &items));
+ });
+ cx.spawn(async move |_, cx| {
+ if let Ok(Some(id)) = rx.await {
+ cx.update(|cx| {
+ if id == settings_id {
+ crate::ferry::open_settings(cx);
+ } else if let Some(peer) = id.checked_sub(MENU_FERRY_BASE).and_then(|i| peers.get(i as usize)) {
+ crate::ferry::send(peer, paths.clone(), cx);
+ }
+ });
+ }
+ })
+ .detach();
+ }
+
pub fn pin(&mut self, dir: PathBuf, cx: &mut Context<Self>) {
let current: Vec<PathBuf> = self.places_pinned_paths(cx);
crate::settings::update(cx, |s| {