feat(settings): add grouped configuration hub, languages and tray controls

This commit is contained in:
aria committed 2026-10-28 03:37:22 +09:00
1 parent 6f34fd080f
commit cc3b6f903f
90 files changed
+3625 -408

No files matched your search

+57 -36
View File
@@ -26,7 +26,7 @@ impl App {
.align_y(Alignment::Center)
.push(visuals::brand_icon())
.push(
self.label("Ferese", 16.)
self.label(ferese_config::tr!("Ferese"), 16.)
.class(cosmic::theme::Text::Color(palette.text)),
)
.width(Length::Fill),
@@ -36,7 +36,7 @@ impl App {
)
.push(widget::Space::new().height(14))
.push(
text_input("Search settings", self.search.clone())
text_input(ferese_config::tr!("Search settings"), self.search.clone())
.id(widget::Id::new("settings-search"))
.on_input(Message::Search)
.font(self.font)
@@ -46,7 +46,7 @@ impl App {
.push(widget::Space::new().height(8));
if compact {
sidebar = sidebar.push(self.settings_button(
"Close navigation",
ferese_config::tr!("Close navigation"),
"M6 6l12 12 M6 18L18 6",
Some(Message::Sidebar(false)),
false,
@@ -56,7 +56,7 @@ impl App {
for (title, pages) in Page::NAVIGATION {
let mut section = column([]).spacing(3).push(
container(
self.label(title, 11.)
self.label(ferese_config::locale::text(title), 11.)
.class(cosmic::theme::Text::Color(palette.muted)),
)
.padding([0, 8]),
@@ -118,13 +118,13 @@ impl App {
)
.width(Length::Fill),
);
if self.page == Page::Appearance && self.search.is_empty() {
if self.page == Page::Theme && self.search.is_empty() {
let automatic = self.draft.string("theme.mode", "dark") == "auto";
heading = heading.push(
row([])
.spacing(8)
.align_y(Alignment::Center)
.push(self.label("Auto", 12.))
.push(self.label(ferese_config::tr!("Auto"), 12.))
.push(
ferese_theme::controls::switch(automatic, palette)
.name(if automatic {
@@ -179,11 +179,18 @@ impl App {
.into_iter()
.flat_map(|(_, pages)| pages.iter().copied())
};
if !pages().any(|p| p.matches(&self.search)) {
body = body
.push(self.note("No matching settings. Try wallpaper, keyboard, or motion."));
if !pages().any(|p| {
p.matches(&self.search)
|| (p == Page::Configuration && self.options.matches(&self.search))
}) {
body = body.push(self.note(ferese_config::tr!(
"No matching settings. Try wallpaper, keyboard, or motion."
)));
}
for page in pages().filter(|p| p.matches(&self.search)) {
for page in pages().filter(|p| {
p.matches(&self.search)
|| (*p == Page::Configuration && self.options.matches(&self.search))
}) {
let destination = page.search_destination(&self.search);
body = body.push(
button::custom(
@@ -199,13 +206,24 @@ impl App {
);
}
} else {
if self.page == Page::Appearance {
body = body.push(self.settings_hub());
}
if self.page == Page::Configuration {
body = body.push(self.all_options_view());
}
if self.page == Page::Tray {
body = body
.push(self.tray_application_controls())
.push(self.tray_status_controls());
}
if self.page == Page::Windows {
body = body.push(visuals::preview_resolved(
&self.draft,
&self.resolved.presented,
));
}
if self.page == Page::Appearance {
if self.page == Page::Theme {
let split = visuals::split(&self.draft);
if split {
body = body
@@ -245,11 +263,11 @@ impl App {
if !fields.is_empty() {
let mut group = column([]).spacing(1);
if self.page == Page::Appearance && self.auto_details {
if self.page == Page::Theme && self.auto_details {
group = group.push(self.auto_controls());
}
for field in fields {
if self.page == Page::Appearance
if self.page == Page::Theme
&& (field.path == "theme.mode"
|| field.path.starts_with("theme.schedule.")
|| field.path.ends_with(".file"))
@@ -258,13 +276,13 @@ impl App {
}
group = group.push(self.field(field));
}
if self.page == Page::Appearance {
if self.page == Page::Theme {
group = group.push(
button::custom(
row([])
.spacing(8)
.align_y(Alignment::Center)
.push(self.label("Advanced customization", 13.))
.push(self.label(ferese_config::tr!("Advanced customization"), 13.))
.push(visuals::action_icon(
if self.advanced_theme {
"M6 15l6-6 6 6"
@@ -298,17 +316,17 @@ impl App {
match self.page {
Page::Connections => body = body.push(self.connections_view()),
Page::LockScreen => {
body = body.push(self.note("Uses your wallpaper, shell colors, font and corner radius from Appearance. Changes apply when the locker or preview opens."));
body = body.push(self.note(ferese_config::tr!("Uses your wallpaper, shell colors, font and corner radius from Appearance. Changes apply when the locker or preview opens.")));
body = body.push(self.settings_button(
"Preview lock screen",
ferese_config::tr!("Preview lock screen"),
"M7 10V7a5 5 0 0 1 10 0v3 M5 10h14v11H5z M12 14v3",
Some(Message::PreviewLock),
false,
));
body = body.push(self.note("The preview is an ordinary window and does not lock your session. Automatic locking is configured separately in Login items."));
body = body.push(self.note(ferese_config::tr!("The preview is an ordinary window and does not lock your session. Automatic locking is configured separately in Login items.")));
}
Page::Startup => {
body = body.push(self.note("Login items update live. Disabling or removing an item stops the session-owned process; enabling one starts it."));
body = body.push(self.note(ferese_config::tr!("Login items update live. Disabling or removing an item stops the session-owned process; enabling one starts it.")));
for index in 0..self.draft.records("autostart") {
let prefix = format!("autostart.{index}");
@@ -338,7 +356,7 @@ impl App {
.push(
container(
self.settings_icon_button(
"Remove login item",
ferese_config::tr!("Remove login item"),
"M4 6h16 M9 6V3h6v3 M6 6l1 15h10l1-15 M10 10v7 M14 10v7",
(!self.saving)
.then_some(Message::Remove("autostart".into(), index)),
@@ -356,16 +374,19 @@ impl App {
row([])
.spacing(8)
.push(
text_input("Program and arguments", self.new_command.clone())
.font(self.font)
.size(12)
.padding([4, 8])
.style(visuals::input_style(palette))
.on_input(Message::NewCommand),
text_input(
ferese_config::tr!("Program and arguments"),
self.new_command.clone(),
)
.font(self.font)
.size(12)
.padding([4, 8])
.style(visuals::input_style(palette))
.on_input(Message::NewCommand),
)
.push(
self.settings_button(
"Add login item",
ferese_config::tr!("Add login item"),
"M12 5v14 M5 12h14",
(!self.saving && !self.new_command.trim().is_empty())
.then_some(Message::AddCommand),
@@ -375,7 +396,7 @@ impl App {
);
}
Page::Shortcuts => {
body = body.push(self.note("Keyboard, mouse and swipe bindings share the same actions. Mouse shortcuts can use MouseLeft, MouseRight, MouseMiddle, MouseBack, MouseForward or WheelUp/Down/Left/Right with modifiers. Use pointer-move or pointer-resize for dragging. Swipes use Swipe3Up, Swipe3Down, Swipe3Left or Swipe3Right (also supports 4 or 5 fingers). Actions such as toggle-overview and none need no argument."));
body = body.push(self.note(ferese_config::tr!("Keyboard, mouse and swipe bindings share the same actions. Mouse shortcuts can use MouseLeft, MouseRight, MouseMiddle, MouseBack, MouseForward or WheelUp/Down/Left/Right with modifiers. Use pointer-move or pointer-resize for dragging. Swipes use Swipe3Up, Swipe3Down, Swipe3Left or Swipe3Right (also supports 4 or 5 fingers). Actions such as toggle-overview and none need no argument.")));
let mut gestures = row([]).spacing(6);
for (keys, label) in [
("Swipe3Up", "Customize swipe up"),
@@ -447,7 +468,7 @@ impl App {
);
}
if self.draft.records("bindings") == 0 {
body = body.push(self.note("You are using the built-in shortcuts. Add custom bindings in config.kdl; they will appear here after Reload."));
body = body.push(self.note(ferese_config::tr!("You are using the built-in shortcuts. Add custom bindings in config.kdl; they will appear here after Reload.")));
}
}
Page::Displays => body = body.push(self.displays_view()),
@@ -459,7 +480,7 @@ impl App {
if compact {
page_heading = page_heading.push(
container(self.settings_icon_button(
"Show settings navigation",
ferese_config::tr!("Show settings navigation"),
"M3 5h18v14H3z M9 5v14",
Some(Message::Sidebar(true)),
))
@@ -478,7 +499,7 @@ impl App {
content = content.push(
container(
row(self.page.subpages().iter().map(|&(page, title)| {
button::custom(self.label(title, 13.))
button::custom(self.label(ferese_config::locale::text(title), 13.))
.name(format!("{}: {title}", self.page.navigation_page().title()))
.padding([7, 12])
.class(visuals::panel_button(palette, self.page == page))
@@ -570,7 +591,7 @@ impl App {
))
.padding(4)
.on_press_maybe((self.undo.is_some() && !self.saving).then_some(Message::Undo)),
self.label("Undo last change", 11.),
self.label(ferese_config::tr!("Undo last change"), 11.),
widget::tooltip::Position::Top,
))
.push(widget::tooltip(
@@ -580,11 +601,11 @@ impl App {
))
.padding(4)
.on_press_maybe((!self.saving).then_some(Message::Reload)),
self.label("Reload configuration", 11.),
self.label(ferese_config::tr!("Reload configuration"), 11.),
widget::tooltip::Position::Top,
));
let footer: Element<'_, Message> = if self.page == Page::Connections {
self.note("Connections are managed by the system. Passwords are not saved in your Ferese config.")
self.note(ferese_config::tr!("Connections are managed by the system. Passwords are not saved in your Ferese config."))
} else if self.page == Page::Bar {
container(
row([])
@@ -597,13 +618,13 @@ impl App {
}))
.push(widget::Space::new().width(Length::Fill))
.push(self.settings_button(
"Undo",
ferese_config::tr!("Undo"),
"M3 10h8 M3 10V3 M3 10c3-7 17-6 17 3a7 7 0 0 1-7 7",
(self.undo.is_some() && !self.saving).then_some(Message::Undo),
false,
))
.push(self.settings_button(
"Reload configuration",
ferese_config::tr!("Reload configuration"),
"M21 3v6h-6 M3 21v-6h6 M3 9a9 9 0 0 1 15-6l3 6 M21 15a9 9 0 0 1-15 6l-3-6",
(!self.saving).then_some(Message::Reload),
false,