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.

Commands to sort by each column, in either direction

JosueMeseroma305c8583a49
diff --git a/crates/rf-app/src/actions.rs b/crates/rf-app/src/actions.rs
index fed95926..0f9087ef 100644
--- a/crates/rf-app/src/actions.rs
+++ b/crates/rf-app/src/actions.rs
@@ -117,6 +117,16 @@ gpui_kit::actions!(
OrganizeFolder,
ToggleAllGroups,
OpenIconThemesFolder,
+ SortNameAToZ,
+ SortNameZToA,
+ SortModifiedNewestFirst,
+ SortModifiedOldestFirst,
+ SortCreatedNewestFirst,
+ SortCreatedOldestFirst,
+ SortTypeAToZ,
+ SortTypeZToA,
+ SortSizeLargestFirst,
+ SortSizeSmallestFirst,
]
);
diff --git a/crates/rf-app/src/command_palette.rs b/crates/rf-app/src/command_palette.rs
index 441cc7e5..5a7d04d6 100644
--- a/crates/rf-app/src/command_palette.rs
+++ b/crates/rf-app/src/command_palette.rs
@@ -78,6 +78,16 @@ fn commands() -> Vec<Cmd> {
cmd!("Sağa döndür", "", L::RotateCw, RotateRight),
cmd!("Sola döndür", "", L::RotateCcw, RotateLeft),
cmd!("Simgeleri küçült", "Ctrl+-", L::ZoomOut, ZoomOut),
+ cmd!("Ada göre sırala, A'dan Z'ye", "", L::ArrowUpDown, SortNameAToZ),
+ cmd!("Ada göre sırala, Z'den A'ya", "", L::ArrowUpDown, SortNameZToA),
+ cmd!("Değiştirme tarihine göre sırala, en yeni önce", "", L::ArrowUpDown, SortModifiedNewestFirst),
+ cmd!("Değiştirme tarihine göre sırala, en eski önce", "", L::ArrowUpDown, SortModifiedOldestFirst),
+ cmd!("Oluşturma tarihine göre sırala, en yeni önce", "", L::ArrowUpDown, SortCreatedNewestFirst),
+ cmd!("Oluşturma tarihine göre sırala, en eski önce", "", L::ArrowUpDown, SortCreatedOldestFirst),
+ cmd!("Türe göre sırala, A'dan Z'ye", "", L::ArrowUpDown, SortTypeAToZ),
+ cmd!("Türe göre sırala, Z'den A'ya", "", L::ArrowUpDown, SortTypeZToA),
+ cmd!("Boyuta göre sırala, en büyük önce", "", L::ArrowUpDown, SortSizeLargestFirst),
+ cmd!("Boyuta göre sırala, en küçük önce", "", L::ArrowUpDown, SortSizeSmallestFirst),
cmd!("Çift panel aç/kapat", "Ctrl+Shift+D", L::Columns2, ToggleDualPane),
cmd!("Panel değiştir", "F6", L::ArrowLeftRight, SwitchPane),
cmd!("Bölmeyi yan yana böl", "", L::Columns2, SplitPaneSideBySide),
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index b99aeddb..797e673b 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -3403,6 +3403,14 @@ impl FolderView {
cx.notify();
}
+ /// By `key` in direction `dir`, whatever the list was sorted by (a sort by a property column ends too). Unlike a click on the
+ /// column header it never flips: the same command again leaves the order as it is, so a shortcut always lands on it.
+ pub fn sort_fixed(&mut self, key: SortKey, dir: SortDir, cx: &mut Context<Self>) {
+ let spec = SortSpec { key, dir, ..self.sort };
+ self.props_drop_sort();
+ self.set_sort_spec(spec, cx);
+ }
+
pub fn set_sort(&mut self, key: SortKey, cx: &mut Context<Self>) {
// from a sort by a property column, a fixed column starts as a new sort (not a flip of the one under it)
self.sort = if self.props.sort_active() { self.props_fixed_sort(key) } else { self.sort.toggled(key) };
diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rs
index 2aeeed87..adb5835f 100644
--- a/crates/rf-app/src/i18n_en.rs
+++ b/crates/rf-app/src/i18n_en.rs
@@ -420,6 +420,16 @@ pub const EN: &[(&str, &str)] = &[
("Seçenekler yüklenemedi", "Couldn't load options"),
("Sıkıştır", "Compress"),
("Sırala", "Sort"),
+ ("Ada göre sırala, A'dan Z'ye", "Sort by name, A to Z"),
+ ("Ada göre sırala, Z'den A'ya", "Sort by name, Z to A"),
+ ("Değiştirme tarihine göre sırala, en yeni önce", "Sort by date modified, newest first"),
+ ("Değiştirme tarihine göre sırala, en eski önce", "Sort by date modified, oldest first"),
+ ("Oluşturma tarihine göre sırala, en yeni önce", "Sort by date created, newest first"),
+ ("Oluşturma tarihine göre sırala, en eski önce", "Sort by date created, oldest first"),
+ ("Türe göre sırala, A'dan Z'ye", "Sort by type, A to Z"),
+ ("Türe göre sırala, Z'den A'ya", "Sort by type, Z to A"),
+ ("Boyuta göre sırala, en büyük önce", "Sort by size, largest first"),
+ ("Boyuta göre sırala, en küçük önce", "Sort by size, smallest first"),
("Sil (Del)", "Delete (Del)"),
("Sütunlar", "Columns"),
("Şununla aç", "Open with"),
diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rs
index 7a0c24fa..08eaa0f3 100644
--- a/crates/rf-app/src/workspace.rs
+++ b/crates/rf-app/src/workspace.rs
@@ -6805,6 +6805,17 @@ impl Render for Workspace {
.on_action(cx.listener(|this, _: &ViewList, _, cx| {
this.with_tab(cx, |v, cx| v.set_layout(ViewMode::Grid, crate::folder_view::GridStyle::List, cx))
}))
+ // a fixed sort for each column and direction (for a shortcut: none of them flips when used again)
+ .on_action(cx.listener(|this, _: &SortNameAToZ, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Name, rf_core::SortDir::Asc, cx))))
+ .on_action(cx.listener(|this, _: &SortNameZToA, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Name, rf_core::SortDir::Desc, cx))))
+ .on_action(cx.listener(|this, _: &SortModifiedNewestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Modified, rf_core::SortDir::Desc, cx))))
+ .on_action(cx.listener(|this, _: &SortModifiedOldestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Modified, rf_core::SortDir::Asc, cx))))
+ .on_action(cx.listener(|this, _: &SortCreatedNewestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Created, rf_core::SortDir::Desc, cx))))
+ .on_action(cx.listener(|this, _: &SortCreatedOldestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Created, rf_core::SortDir::Asc, cx))))
+ .on_action(cx.listener(|this, _: &SortTypeAToZ, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Type, rf_core::SortDir::Asc, cx))))
+ .on_action(cx.listener(|this, _: &SortTypeZToA, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Type, rf_core::SortDir::Desc, cx))))
+ .on_action(cx.listener(|this, _: &SortSizeLargestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Size, rf_core::SortDir::Desc, cx))))
+ .on_action(cx.listener(|this, _: &SortSizeSmallestFirst, _, cx| this.with_tab(cx, |v, cx| v.sort_fixed(rf_core::SortKey::Size, rf_core::SortDir::Asc, cx))))
.on_action(cx.listener(|this, _: &FocusSearch, window, cx| {
this.enter_search(window, cx);
}))