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(