Skip to content

Commit a64ee73

Browse files
committed
Reduce batch size, change default to home
1 parent 7c22748 commit a64ee73

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub const DEFAULT_WINDOW_HEIGHT: f32 = 100.;
2525
pub const FILE_SEARCH_MAX_RESULTS: u32 = 400;
2626

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

3030
/// The rustcast descriptor name to be put for all rustcast commands
3131
pub const RUSTCAST_DESC_NAME: &str = "Utility";

src/app/tile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,6 @@ async fn read_mdfind_results(
392392
) {
393393
use crate::app::{FILE_SEARCH_BATCH_SIZE, FILE_SEARCH_MAX_RESULTS};
394394

395-
assert!(!home_dir.is_empty(), "Home directory must not be empty.");
396-
397395
let mut reader = tokio::io::BufReader::new(stdout);
398396
let mut batch: Vec<crate::app::apps::App> = Vec::with_capacity(FILE_SEARCH_BATCH_SIZE as usize);
399397
let mut total_sent: u32 = 0;
@@ -487,6 +485,7 @@ fn handle_file_search() -> impl futures::Stream<Item = Message> {
487485
// The query is passed as a -name argument to mdfind. mdfind interprets
488486
// this as a substring match on filenames — not as a glob or shell expression.
489487
// Passed via args (not shell), so no shell injection risk.
488+
// When dirs is empty, omit -onlyin so mdfind searches system-wide.
490489
let mut args: Vec<String> = vec!["-name".to_string(), query.clone()];
491490
for dir in &dirs {
492491
let expanded = dir.replace("~", &home_dir);

src/config.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ impl Default for Config {
4545
search_url: "https://google.com/search?q=%s".to_string(),
4646
haptic_feedback: false,
4747
show_trayicon: true,
48-
search_dirs: vec![
49-
"~/Documents".to_string(),
50-
"~/Desktop".to_string(),
51-
"~/Downloads".to_string(),
52-
],
48+
search_dirs: vec!["~".to_string()],
5349
log_path: "/tmp/rustcast.log".to_string(),
5450
modes: HashMap::new(),
5551
aliases: HashMap::new(),

0 commit comments

Comments
 (0)