support hide search
This commit is contained in:
parent
1423fd68e7
commit
cb775dc50a
2 changed files with 13 additions and 2 deletions
|
@ -295,8 +295,11 @@ pub struct Config {
|
||||||
// todo re-add this
|
// todo re-add this
|
||||||
// #[serde(flatten)]
|
// #[serde(flatten)]
|
||||||
// key_custom: Option<HashMap<String, String>>,
|
// key_custom: Option<HashMap<String, String>>,
|
||||||
global_coords: Option<bool>, // todo support this
|
global_coords: Option<bool>, // todo support this
|
||||||
hide_search: 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
|
dynamic_lines: Option<bool>, // todo support this
|
||||||
layer: Option<String>, // todo support this
|
layer: Option<String>, // todo support this
|
||||||
copy_exec: Option<String>, // todo support this
|
copy_exec: Option<String>, // todo support this
|
||||||
|
@ -478,6 +481,11 @@ impl Config {
|
||||||
pub fn insensitive(&self) -> bool {
|
pub fn insensitive(&self) -> bool {
|
||||||
self.insensitive.unwrap_or(true)
|
self.insensitive.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn hide_search(&self) -> bool {
|
||||||
|
self.hide_search.unwrap_or(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_false() -> bool {
|
fn default_false() -> bool {
|
||||||
|
|
|
@ -349,6 +349,9 @@ fn build_search_entry<T: Clone>(config: &Config, ui_elements: &UiElements<T>) {
|
||||||
.search
|
.search
|
||||||
.set_placeholder_text(Some(config.prompt().as_ref()));
|
.set_placeholder_text(Some(config.prompt().as_ref()));
|
||||||
ui_elements.search.set_can_focus(false);
|
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>(
|
fn build_ui_from_menu_items<T: Clone + 'static>(
|
||||||
|
|
Loading…
Add table
Reference in a new issue