support hide search

This commit is contained in:
Alexander Mohr 2025-05-01 22:01:52 +02:00
parent 1423fd68e7
commit cb775dc50a
2 changed files with 13 additions and 2 deletions

View file

@ -295,8 +295,11 @@ pub struct Config {
// todo re-add this
// #[serde(flatten)]
// key_custom: Option<HashMap<String, String>>,
global_coords: Option<bool>, // todo support this
hide_search: Option<bool>, // todo support this
global_coords: Option<bool>, // todo support this
/// If set to `true` the search field will be hidden.
#[clap(long = "hide-search")]
hide_search: Option<bool>,
dynamic_lines: Option<bool>, // todo support this
layer: Option<String>, // todo support this
copy_exec: Option<String>, // 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 {

View file

@ -349,6 +349,9 @@ fn build_search_entry<T: Clone>(config: &Config, ui_elements: &UiElements<T>) {
.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<T: Clone + 'static>(