From 8d8536da211fa530298358de08bc0aa453dcfc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= Date: Thu, 27 Mar 2025 15:04:33 +0100 Subject: [PATCH] fix(startup_apps): improve interface --- .../src/pages/applications/startup_apps.rs | 57 ++++++++++--------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/cosmic-settings/src/pages/applications/startup_apps.rs b/cosmic-settings/src/pages/applications/startup_apps.rs index 912ae9b..67eaf09 100644 --- a/cosmic-settings/src/pages/applications/startup_apps.rs +++ b/cosmic-settings/src/pages/applications/startup_apps.rs @@ -310,7 +310,7 @@ impl Page { directory_type: DirectoryType, ) -> Element<'_, crate::pages::Message> { let cosmic::cosmic_theme::Spacing { - space_s, space_l, .. + space_xs, space_l, .. } = cosmic::theme::spacing(); let search = widget::search_input(fl!("type-to-search"), &self.application_search) @@ -328,26 +328,25 @@ impl Page { || exec.to_lowercase().contains(search_input) || name.to_lowercase().contains(search_input) { - let mut row = widget::row::with_capacity(2).spacing(space_s); + let mut row = widget::row::with_capacity(3) + .spacing(space_xs) + .align_y(Alignment::Center); - row = row - .push(icon::from_name(app.icon().unwrap_or("application-default"))); + row = row.push( + icon::from_name(app.icon().unwrap_or("application-default")) + .size(32), + ); if let Some(name) = app.name(&startup_apps.locales) { - row = row.push(text(name)); + row = row.push(text(name).width(Length::Fill)); } else { - row = row.push(text(&app.appid)); + row = row.push(text(&app.appid).width(Length::Fill)); } + row = row.push(widget::button::text(fl!("add")).on_press( + Message::AddStartupApplication(directory_type.clone(), app.clone()), + )); - list = list.add(settings::flex_item_row(vec![ - row.into(), - widget::button::text(fl!("add")) - .on_press(Message::AddStartupApplication( - directory_type.clone(), - app.clone(), - )) - .into(), - ])) + list = list.add(row) } } } @@ -366,7 +365,9 @@ impl Page { fn apps() -> Section { let cosmic::cosmic_theme::Spacing { - space_xxs, space_s, .. + space_xxs, + space_xs, + .. } = cosmic::theme::spacing(); Section::default() @@ -387,28 +388,32 @@ fn apps() -> Section { if let Some(apps) = startup_apps.apps.get(&directory_type) { for app in apps { - let mut row = widget::row::with_capacity(2).spacing(space_s); + let mut row = widget::row::with_capacity(3) + .spacing(space_xs) + .align_y(Alignment::Center); - row = row - .push(icon::from_name(app.icon().unwrap_or("application-default"))); + row = row.push( + icon::from_name(app.icon().unwrap_or("application-default")) + .size(32), + ); if let Some(name) = app.name(&startup_apps.locales) { - row = row.push(text(name)); + row = row.push(text(name).width(Length::Fill)); } else { - row = row.push(text(&app.appid)); + row = row.push(text(&app.appid).width(Length::Fill)); } - section = section.add(settings::flex_item_row(vec![ - row.into(), + row = row.push( button::icon(icon::from_name("edit-delete-symbolic")) .extra_small() .on_press(Message::RemoveStartupApplication( directory_type.clone(), app.clone(), false, - )) - .into(), - ])) + )), + ); + + section = section.add(row) } }