Skip to content

Commit 72d1ea0

Browse files
authored
Merge pull request #227 from tanishq-dubey/master
Switch to NSMetadataQuery for search, add file icons
2 parents a7f2f18 + 898df72 commit 72d1ea0

File tree

4 files changed

+334
-112
lines changed

4 files changed

+334
-112
lines changed

Cargo.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ objc2-application-services = { version = "0.3.2", default-features = false, feat
2626
"Processes",
2727
] }
2828
objc2-core-foundation = "0.3.2"
29-
objc2-foundation = { version = "0.3.2", features = ["NSString"] }
29+
objc2-foundation = { version = "0.3.2", features = [
30+
"NSString",
31+
"NSArray",
32+
"NSDate",
33+
"NSMetadata",
34+
"NSMetadataAttributes",
35+
"NSNotification",
36+
"NSObjCRuntime",
37+
"NSOperation",
38+
"NSPredicate",
39+
"NSRunLoop",
40+
] }
3041
once_cell = "1.21.3"
3142
rand = "0.9.2"
3243
rayon = "1.11.0"

src/app.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ pub const WINDOW_WIDTH: f32 = 500.;
2121
/// The default window height
2222
pub const DEFAULT_WINDOW_HEIGHT: f32 = 100.;
2323

24-
/// Maximum file search results returned by a single mdfind invocation.
24+
/// Maximum file search results returned by a single query.
2525
pub const FILE_SEARCH_MAX_RESULTS: u32 = 400;
2626

2727
/// Number of results to accumulate before flushing a batch to the UI.
2828
pub const FILE_SEARCH_BATCH_SIZE: u32 = 10;
2929

30+
/// Maximum number of file search results that get icons loaded.
31+
pub const FILE_SEARCH_MAX_ICONS: usize = 20;
32+
33+
/// Number of icons to accumulate before flushing a batch to the UI.
34+
pub const FILE_SEARCH_ICON_BATCH_SIZE: usize = 5;
35+
3036
/// The rustcast descriptor name to be put for all rustcast commands
3137
pub const RUSTCAST_DESC_NAME: &str = "Utility";
3238

@@ -111,6 +117,7 @@ pub enum Message {
111117
ChangeFocus(ArrowKey, u32),
112118
FileSearchResult(Vec<App>),
113119
FileSearchClear,
120+
FileSearchIcons(Vec<(usize, iced::widget::image::Handle)>),
114121
SetFileSearchSender(tokio::sync::watch::Sender<(String, Vec<String>)>),
115122
DebouncedSearch(Id),
116123
}

0 commit comments

Comments
 (0)