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).
This commit is contained in:
Vukašin Vojinović 2025-08-28 12:05:03 +02:00 committed by Michael Murphy
parent d2a041f2ca
commit 842e6f4bac
3 changed files with 38 additions and 38 deletions

View file

@ -381,61 +381,61 @@ fn apps() -> Section<crate::pages::Message> {
Section::default()
.title(fl!("startup-apps"))
.view::<Page>(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),
));
);
}
}

View file

@ -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

View file

@ -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;