Issue-ID: config-andminor startup improvement
Signed-off-by: Alexander Mohr <git@mohr.io>
This commit is contained in:
parent
4f4bd116f9
commit
d9c53a3acf
3 changed files with 20 additions and 13 deletions
|
@ -43,7 +43,7 @@ pub enum WrapMode {
|
|||
Inherit,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub enum SortOrder {
|
||||
Default,
|
||||
Alphabetical,
|
||||
|
|
|
@ -566,13 +566,17 @@ fn build_ui<T, P>(
|
|||
|
||||
let animate_cfg = config.clone();
|
||||
let animate_window = ui_elements.window.clone();
|
||||
timeout_add_local(Duration::from_millis(5), move || {
|
||||
if !animate_window.is_active() {
|
||||
return ControlFlow::Continue;
|
||||
}
|
||||
animate_window.set_opacity(1.0);
|
||||
window_show_resize(&animate_cfg.clone(), &animate_window);
|
||||
ControlFlow::Break
|
||||
// timeout_add_local(Duration::from_millis(1), move || {
|
||||
// if !animate_window.is_active() {
|
||||
// return ControlFlow::Continue;
|
||||
// }
|
||||
// animate_window.set_opacity(1.0);
|
||||
// window_show_resize(&animate_cfg.clone(), &animate_window);
|
||||
// ControlFlow::Break
|
||||
// });
|
||||
animate_window.connect_is_active_notify(move |w| {
|
||||
w.set_opacity(1.0);
|
||||
window_show_resize(&animate_cfg.clone(), w);
|
||||
});
|
||||
|
||||
// hide the fact that we are starting with a small window
|
||||
|
@ -1206,6 +1210,10 @@ fn set_menu_visibility_for_search<T: Clone>(
|
|||
config: &Config,
|
||||
search_ignored_words: Option<&Vec<Regex>>,
|
||||
) {
|
||||
if config.sort_order() == SortOrder::Default {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
if query.is_empty() {
|
||||
for (fb, menu_item) in items.iter_mut() {
|
||||
|
|
|
@ -589,20 +589,19 @@ struct DMenuProvider {
|
|||
|
||||
impl DMenuProvider {
|
||||
fn new(sort_order: &SortOrder) -> Result<DMenuProvider, Error> {
|
||||
log::debug!("parsing stdin");
|
||||
let mut input = String::new();
|
||||
io::stdin()
|
||||
.read_to_string(&mut input)
|
||||
.map_err(|_| Error::StdInReadFail)?;
|
||||
.expect("Failed to read from stdin");
|
||||
|
||||
let mut items: Vec<MenuItem<String>> = input
|
||||
.lines()
|
||||
.map(String::from)
|
||||
.map(|s| MenuItem::new(s.clone(), None, None, vec![], None, 0.0, None))
|
||||
.rev()
|
||||
.map(|s| MenuItem::new(s.to_string(), None, None, vec![], None, 0.0, None))
|
||||
.collect();
|
||||
|
||||
log::debug!("parsed stdin");
|
||||
gui::apply_sort(&mut items, sort_order);
|
||||
|
||||
Ok(Self { items })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue