Skip to content

Commit 4b1496d

Browse files
committed
add aliases to rustcast
1 parent 842ff1e commit 4b1496d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/app/tile/update.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,11 @@ pub fn handle_update(tile: &mut Tile, message: Message) -> Task<Message> {
421421
}
422422

423423
tile.query_lc = input.trim().to_lowercase();
424-
tile.query = input;
424+
tile.query = input.clone();
425+
426+
if let Some(alias) = tile.config.aliases.get(&input.trim().to_lowercase()) {
427+
tile.query_lc = alias.to_string();
428+
}
425429

426430
let prev_size = tile.results.len();
427431

src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct Config {
2727
pub show_trayicon: bool,
2828
pub shells: Vec<Shelly>,
2929
pub modes: HashMap<String, String>,
30+
pub aliases: HashMap<String, String>,
3031
pub log_path: String,
3132
}
3233

@@ -44,6 +45,7 @@ impl Default for Config {
4445
show_trayicon: true,
4546
log_path: "/tmp/rustcast.log".to_string(),
4647
modes: HashMap::new(),
48+
aliases: HashMap::new(),
4749
shells: vec![],
4850
}
4951
}

0 commit comments

Comments
 (0)