Skip to content

Commit

Permalink
feat: sort start menu items in alphabetical order
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
  • Loading branch information
ryanabx committed Sep 17, 2024
1 parent 730227a commit c73eb17
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/start_menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ impl<'a> StartMenu<'a> {
}

pub fn view_popup(&self) -> iced::Element<StartMenuMessage> {
let locales = get_languages_from_env();
let mut keys = self.de_cache.0.iter().collect::<Vec<_>>();
keys.sort_by(|e, e2| {
e.1.desktop_entry
.name(&locales)
.unwrap_or("".into())
.cmp(&e2.1.desktop_entry.name(&locales).unwrap_or("".into()))
});
iced::widget::scrollable(
iced::widget::column(self.de_cache.0.values().filter_map(view_menu_item))
iced::widget::column(keys.iter().filter_map(|(_, val)| view_menu_item(val)))
.height(Length::Shrink)
.width(Length::Fill)
.spacing(10),
Expand Down

0 comments on commit c73eb17

Please sign in to comment.