From 842e6f4bac0a7960a17c404041d5507da9ac5eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= <150025636+git-f0x@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:05:03 +0200 Subject: [PATCH] improv(startup_apps): match designs Adds an empty list item with text when there aren't any startup apps and replaces the heading with a modified description (removing the description). --- .../src/pages/applications/startup_apps.rs | 70 +++++++++---------- i18n/en/cosmic_settings.ftl | 4 +- pages/wallpapers/src/lib.rs | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/cosmic-settings/src/pages/applications/startup_apps.rs b/cosmic-settings/src/pages/applications/startup_apps.rs index 58bcbc1..2ca58b2 100644 --- a/cosmic-settings/src/pages/applications/startup_apps.rs +++ b/cosmic-settings/src/pages/applications/startup_apps.rs @@ -381,61 +381,61 @@ fn apps() -> Section { Section::default() .title(fl!("startup-apps")) .view::(move |_binder, page, _section| { - let mut view = widget::column::with_capacity(4).spacing(space_xxs); + let mut view = widget::column::with_capacity(3).spacing(space_xxs); if let Some(startup_apps) = &page.cached_startup_apps { let order = vec![DirectoryType::User]; for directory_type in order { let mut section = settings::section(); - view = view - .push(text::heading(directory_type.to_string())) - .push(text(match directory_type { - DirectoryType::User => fl!("startup-apps", "user-description"), - })); + view = view.push(text::heading(directory_type.to_string())); if let Some(apps) = startup_apps.apps.get(&directory_type) { - for app in apps { - let mut row = widget::row::with_capacity(3) - .spacing(space_xs) - .align_y(Alignment::Center); + if apps.is_empty() { + section = section.add(text::body(fl!("startup-apps", "none"))) + } else { + for app in apps { + 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")) - .size(32), - ); + 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).width(Length::Fill)); - } else { - row = row.push(text(&app.appid).width(Length::Fill)); + if let Some(name) = app.name(&startup_apps.locales) { + row = row.push(text::body(name).width(Length::Fill)); + } else { + row = row.push(text::body(&app.appid).width(Length::Fill)); + } + + 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) } - - 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) } } let add_startup_app = widget::button::standard(fl!("startup-apps", "add")) .on_press(Message::ShowApplicationSidebar(directory_type.clone()).into()); - view = view.push(section).push(widget::container( + view = view.push(section).push( widget::container(add_startup_app) .width(Length::Fill) .align_x(Alignment::End), - )); + ); } } diff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl index 3f664ce..59ffb08 100644 --- a/i18n/en/cosmic_settings.ftl +++ b/i18n/en/cosmic_settings.ftl @@ -826,8 +826,8 @@ default-apps = Default Applications startup-apps = Startup Applications .desc = Configure applications which run on login. .add = Add app - .user = User specific applications - .user-description = These applications are launched when you log into your current user. + .user = Applications launched when you log in + .none = No startup applications added .remove-dialog-title = Remove { $name }? .remove-dialog-description = Are you sure you want to remove this as a startup application? .search-for-application = Search for application diff --git a/pages/wallpapers/src/lib.rs b/pages/wallpapers/src/lib.rs index 47c72a5..fe7e338 100644 --- a/pages/wallpapers/src/lib.rs +++ b/pages/wallpapers/src/lib.rs @@ -1,5 +1,5 @@ pub use cosmic_bg_config::{Color, Config, Entry, Gradient, ScalingMode, Source}; -use eyre::{OptionExt, eyre}; +use eyre::eyre; use fast_image_resize::SrcCropping; use futures_lite::Stream; use futures_util::StreamExt;