feat(settings): add grouped configuration hub, languages and tray controls
This commit is contained in:
1 parent
6f34fd080f
commit
cc3b6f903f
90 files changed
+3625
-408
No files matched your search
@@ -1,6 +1,10 @@
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Page {
|
||||
Appearance,
|
||||
General,
|
||||
Theme,
|
||||
Tray,
|
||||
Configuration,
|
||||
Accessibility,
|
||||
Wallpaper,
|
||||
Bar,
|
||||
@@ -16,8 +20,12 @@ pub enum Page {
|
||||
}
|
||||
|
||||
impl Page {
|
||||
pub const NAVIGATION: [(&'static str, &'static [Self]); 3] = [
|
||||
("Desktop", &[Self::Appearance, Self::Wallpaper, Self::Bar]),
|
||||
pub const NAVIGATION: [(&'static str, &'static [Self]); 5] = [
|
||||
("Appearance", &[Self::Appearance, Self::General]),
|
||||
(
|
||||
"Desktop",
|
||||
&[Self::Theme, Self::Wallpaper, Self::Bar, Self::Tray],
|
||||
),
|
||||
(
|
||||
"Interaction",
|
||||
&[Self::Windows, Self::Keyboard, Self::Accessibility],
|
||||
@@ -32,6 +40,7 @@ impl Page {
|
||||
Self::Startup,
|
||||
],
|
||||
),
|
||||
("Advanced", &[Self::Configuration]),
|
||||
];
|
||||
|
||||
/// Subpages share one entry in navigation and search.
|
||||
@@ -66,8 +75,12 @@ impl Page {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub const ALL: [Self; 13] = [
|
||||
pub const ALL: [Self; 17] = [
|
||||
Self::Appearance,
|
||||
Self::General,
|
||||
Self::Theme,
|
||||
Self::Tray,
|
||||
Self::Configuration,
|
||||
Self::Accessibility,
|
||||
Self::Wallpaper,
|
||||
Self::Bar,
|
||||
@@ -83,8 +96,15 @@ impl Page {
|
||||
];
|
||||
|
||||
pub fn title(self) -> &'static str {
|
||||
ferese_config::locale::text(self.title_key())
|
||||
}
|
||||
fn title_key(self) -> &'static str {
|
||||
match self {
|
||||
Self::Appearance => "Appearance",
|
||||
Self::General => "General",
|
||||
Self::Tray => "Tray icons",
|
||||
Self::Configuration => "All options",
|
||||
Self::Theme => "Theme",
|
||||
Self::Accessibility => "Accessibility",
|
||||
Self::Wallpaper => "Wallpaper",
|
||||
Self::Bar => "Panel & Shell",
|
||||
@@ -101,8 +121,14 @@ impl Page {
|
||||
}
|
||||
|
||||
pub fn subtitle(self) -> &'static str {
|
||||
match self {
|
||||
Self::Appearance => "A desktop that feels like yours.",
|
||||
ferese_config::locale::text(match self {
|
||||
Self::Appearance => "All Ferese settings, grouped by function.",
|
||||
Self::General => "Language and desktop preferences.",
|
||||
Self::Tray => "Choose which status and application icons appear in the panel.",
|
||||
Self::Configuration => {
|
||||
"Every supported configuration option, including advanced settings."
|
||||
}
|
||||
Self::Theme => "A desktop that feels like yours.",
|
||||
Self::Accessibility => "Make the desktop easier to see and use.",
|
||||
Self::Wallpaper => "Set the scene for your workspace.",
|
||||
Self::Bar => "Arrange your panel and change the shell's appearance.",
|
||||
@@ -115,7 +141,7 @@ impl Page {
|
||||
Self::Startup => "Ready when you sign in.",
|
||||
Self::Displays => "A place for every screen.",
|
||||
Self::Connections => "Wi-Fi networks and Bluetooth devices.",
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn icon(self) -> &'static str {
|
||||
@@ -123,7 +149,11 @@ impl Page {
|
||||
Self::Accessibility => {
|
||||
"M12 3a2 2 0 1 0 0 4a2 2 0 1 0 0-4 M4 9h16 M12 9v6 M12 15l-5 6 M12 15l5 6"
|
||||
}
|
||||
Self::Appearance => {
|
||||
Self::Appearance | Self::General | Self::Configuration => {
|
||||
"M4 5h16 M4 12h16 M4 19h16 M8 3v4 M16 10v4 M10 17v4"
|
||||
}
|
||||
Self::Tray => "M3 5h18v14H3z M6 9h3v3H6z M12 9h3v3h-3z M18 9h.01",
|
||||
Self::Theme => {
|
||||
"M12 3a9 9 0 1 0 0 18h1a2 2 0 0 0 0-4h-1a1 1 0 0 1 0-2h3a6 6 0 0 0 0-12z M7 9h.01 M10 6h.01 M15 6h.01 M18 10h.01"
|
||||
}
|
||||
Self::Wallpaper => "M4 4h16v16H4z M4 16l5-5 4 4 3-3 4 4 M15 8h.01",
|
||||
@@ -157,11 +187,31 @@ impl Page {
|
||||
fn matches_own(self, query: &str) -> bool {
|
||||
let query = query.to_lowercase();
|
||||
self.title().to_lowercase().contains(&query)
|
||||
|| self.title_key().to_lowercase().contains(&query)
|
||||
|| ferese_config::locale::in_language(
|
||||
ferese_config::locale::Language::Chinese,
|
||||
self.title_key(),
|
||||
)
|
||||
.to_lowercase()
|
||||
.contains(&query)
|
||||
|| self.subtitle().to_lowercase().contains(&query)
|
||||
|| fields(self).iter().any(|f| {
|
||||
format!("{} {} {}", f.label, f.description, f.path)
|
||||
.to_lowercase()
|
||||
.contains(&query)
|
||||
format!(
|
||||
"{} {} {} {} {}",
|
||||
f.label,
|
||||
f.description,
|
||||
f.path,
|
||||
ferese_config::locale::in_language(
|
||||
ferese_config::locale::Language::Chinese,
|
||||
&f.label
|
||||
),
|
||||
ferese_config::locale::in_language(
|
||||
ferese_config::locale::Language::Chinese,
|
||||
&f.description
|
||||
)
|
||||
)
|
||||
.to_lowercase()
|
||||
.contains(&query)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -375,7 +425,7 @@ pub fn fields(page: Page) -> Vec<Field> {
|
||||
false,
|
||||
),
|
||||
],
|
||||
Page::Appearance => vec![
|
||||
Page::Theme => vec![
|
||||
choice(
|
||||
"theme.mode",
|
||||
"Appearance",
|
||||
@@ -910,6 +960,57 @@ pub fn fields(page: Page) -> Vec<Field> {
|
||||
"Keep the shortcut guide until you are comfortable with Ferese.",
|
||||
true,
|
||||
)],
|
||||
Page::Startup | Page::Displays | Page::Connections => vec![],
|
||||
Page::General => vec![choice(
|
||||
"ui.language",
|
||||
"Language",
|
||||
"Changes the Ferese interface language. Applies immediately.",
|
||||
"auto",
|
||||
&[
|
||||
("auto", "Follow system"),
|
||||
("zh-CN", "简体中文"),
|
||||
("en", "English"),
|
||||
],
|
||||
)],
|
||||
Page::Tray => vec![
|
||||
toggle(
|
||||
"status.tray.enabled",
|
||||
"Show tray icons",
|
||||
"Show application icons in panel tray items.",
|
||||
true,
|
||||
),
|
||||
toggle(
|
||||
"status.tray.show_passive",
|
||||
"Show passive icons",
|
||||
"Include applications without active status.",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"status.tray.icon_size",
|
||||
"Tray icon size",
|
||||
"Size of application tray icons.",
|
||||
RangeSpec {
|
||||
default: 16.,
|
||||
min: 8.,
|
||||
max: 48.,
|
||||
step: 1.,
|
||||
suffix: " px",
|
||||
integer: true,
|
||||
},
|
||||
),
|
||||
Field::new(
|
||||
"status.tray.hidden_items",
|
||||
"Hidden applications",
|
||||
"Application IDs to hide, separated by spaces.",
|
||||
Kind::Text {
|
||||
default: "",
|
||||
argv: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
Page::Appearance
|
||||
| Page::Configuration
|
||||
| Page::Startup
|
||||
| Page::Displays
|
||||
| Page::Connections => vec![],
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user