From cb775dc50a8a6c8c6cca972308d5f7de69b171f0 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Thu, 1 May 2025 22:01:52 +0200 Subject: [PATCH] support hide search --- src/lib/config.rs | 12 ++++++++++-- src/lib/gui.rs | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/config.rs b/src/lib/config.rs index 855297a..ea914ad 100644 --- a/src/lib/config.rs +++ b/src/lib/config.rs @@ -295,8 +295,11 @@ pub struct Config { // todo re-add this // #[serde(flatten)] // key_custom: Option>, - global_coords: Option, // todo support this - hide_search: Option, // todo support this + global_coords: Option, // todo support this + + /// If set to `true` the search field will be hidden. + #[clap(long = "hide-search")] + hide_search: Option, dynamic_lines: Option, // todo support this layer: Option, // todo support this copy_exec: Option, // todo support this @@ -478,6 +481,11 @@ impl Config { pub fn insensitive(&self) -> bool { self.insensitive.unwrap_or(true) } + + #[must_use] + pub fn hide_search(&self) -> bool { + self.hide_search.unwrap_or(false) + } } fn default_false() -> bool { diff --git a/src/lib/gui.rs b/src/lib/gui.rs index d19ff8d..aa0f3ed 100644 --- a/src/lib/gui.rs +++ b/src/lib/gui.rs @@ -349,6 +349,9 @@ fn build_search_entry(config: &Config, ui_elements: &UiElements) { .search .set_placeholder_text(Some(config.prompt().as_ref())); ui_elements.search.set_can_focus(false); + if config.hide_search() { + ui_elements.search.set_visible(false); + } } fn build_ui_from_menu_items(