Add desktop widgets and streamline documentation
This commit is contained in:
1 parent
c63af64d87
commit
8dc895448d
25 files changed
+2724
-3686
No files matched your search
@@ -2,6 +2,7 @@
|
||||
pub enum Page {
|
||||
Appearance,
|
||||
Wallpaper,
|
||||
Desktop,
|
||||
Bar,
|
||||
Windows,
|
||||
Motion,
|
||||
@@ -11,9 +12,10 @@ pub enum Page {
|
||||
Displays,
|
||||
}
|
||||
impl Page {
|
||||
pub const ALL: [Self; 9] = [
|
||||
pub const ALL: [Self; 10] = [
|
||||
Self::Appearance,
|
||||
Self::Wallpaper,
|
||||
Self::Desktop,
|
||||
Self::Bar,
|
||||
Self::Windows,
|
||||
Self::Motion,
|
||||
@@ -26,6 +28,7 @@ impl Page {
|
||||
match self {
|
||||
Self::Appearance => "Appearance",
|
||||
Self::Wallpaper => "Wallpaper",
|
||||
Self::Desktop => "Desktop widgets",
|
||||
Self::Bar => "Menu bar",
|
||||
Self::Windows => "Windows",
|
||||
Self::Motion => "Motion",
|
||||
@@ -39,6 +42,7 @@ impl Page {
|
||||
match self {
|
||||
Self::Appearance => "A desktop that feels like yours.",
|
||||
Self::Wallpaper => "Set the scene for your workspace.",
|
||||
Self::Desktop => "A clock that feels at home on your wallpaper.",
|
||||
Self::Bar => "Everything you need, within reach.",
|
||||
Self::Windows => "Make room for the way you work.",
|
||||
Self::Motion => "Find your rhythm.",
|
||||
@@ -54,6 +58,7 @@ impl Page {
|
||||
"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",
|
||||
Self::Desktop => "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0 M12 7v5l3 2",
|
||||
Self::Bar => "M3 5h18v14H3z M3 9h18 M6 7h.01 M18 7h.01",
|
||||
Self::Windows => "M3 4h12v12H3z M8 9h13v12H8z",
|
||||
Self::Motion => "M3 8h9a3 3 0 1 0-3-3 M3 12h15a3 3 0 1 1-3 3 M3 16h5",
|
||||
@@ -174,6 +179,367 @@ fn choice(
|
||||
Field::new(path, label, description, Kind::Choice { default, choices })
|
||||
}
|
||||
|
||||
fn clock_fields() -> Vec<Field> {
|
||||
vec![
|
||||
toggle(
|
||||
"desktop_widgets.clock.enabled",
|
||||
"Desktop clock",
|
||||
"Behind windows and click-through.",
|
||||
false,
|
||||
),
|
||||
toggle(
|
||||
"desktop_widgets.clock.bold",
|
||||
"Bold text",
|
||||
"Use the font's bold weight.",
|
||||
false,
|
||||
),
|
||||
toggle(
|
||||
"desktop_widgets.clock.show_date",
|
||||
"Show date",
|
||||
"A separate line beneath the time.",
|
||||
true,
|
||||
),
|
||||
toggle(
|
||||
"desktop_widgets.clock.lowercase",
|
||||
"Lowercase",
|
||||
"Lowercase month, weekday and am/pm.",
|
||||
true,
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.anchor",
|
||||
"Position",
|
||||
"top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right",
|
||||
"top_left",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.font_family",
|
||||
"Font",
|
||||
"Empty follows the desktop font.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.time_format",
|
||||
"Time format",
|
||||
"%H:%M for 24-hour; %-I:%M %p for 12-hour; add :%S for seconds.",
|
||||
"%-I:%M %p",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.date_format",
|
||||
"Date format",
|
||||
"%A, %-d %B for weekday and date; %-d %b for a short date.",
|
||||
"%A, %-d %B",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.time_zone",
|
||||
"Time zone",
|
||||
"Empty follows system time; otherwise an IANA name such as Africa/Lagos.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.color",
|
||||
"Time color",
|
||||
"#RRGGBB or #RRGGBBAA; empty follows the theme.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.date_color",
|
||||
"Date color",
|
||||
"Empty follows muted theme text.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
"desktop_widgets.clock.background",
|
||||
"Background",
|
||||
"Empty is transparent; optionally #RRGGBB or #RRGGBBAA.",
|
||||
"",
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.margin_x",
|
||||
"Horizontal margin",
|
||||
"Distance from left/right edge; ignored when horizontally centered.",
|
||||
64.0,
|
||||
0.0,
|
||||
1000.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.margin_y",
|
||||
"Vertical margin",
|
||||
"Distance from top/bottom edge; ignored when vertically centered.",
|
||||
80.0,
|
||||
0.0,
|
||||
1000.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.width",
|
||||
"Widget width",
|
||||
"Logical pixels; increase for longer formats.",
|
||||
440.0,
|
||||
64.0,
|
||||
1600.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.height",
|
||||
"Widget height",
|
||||
"Leave room for both text lines.",
|
||||
160.0,
|
||||
32.0,
|
||||
800.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.time_size",
|
||||
"Time size",
|
||||
"Logical pixels; scales with your output.",
|
||||
72.0,
|
||||
8.0,
|
||||
240.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.date_size",
|
||||
"Date size",
|
||||
"Separate size for the date line.",
|
||||
18.0,
|
||||
8.0,
|
||||
96.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.opacity",
|
||||
"Opacity",
|
||||
"Applies to text and the optional background.",
|
||||
0.9,
|
||||
0.0,
|
||||
1.0,
|
||||
0.05,
|
||||
"",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.gap",
|
||||
"Line spacing",
|
||||
"Space between time and date.",
|
||||
4.0,
|
||||
0.0,
|
||||
64.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.padding",
|
||||
"Inner padding",
|
||||
"Space around the labels.",
|
||||
12.0,
|
||||
0.0,
|
||||
64.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
"desktop_widgets.clock.radius",
|
||||
"Background radius",
|
||||
"Used only when a background is set.",
|
||||
16.0,
|
||||
0.0,
|
||||
128.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
choice(
|
||||
"desktop_widgets.clock.alignment",
|
||||
"Text alignment",
|
||||
"Alignment within the widget.",
|
||||
"center",
|
||||
&[("left", "Left"), ("center", "Center"), ("right", "Right")],
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
pub fn note_fields(index: usize) -> Vec<Field> {
|
||||
let prefix = format!("desktop_widgets.notes.{index}");
|
||||
vec![
|
||||
Field::new(
|
||||
format!("{prefix}.interactive"),
|
||||
"Desktop editing",
|
||||
"Drag the title and edit directly. Off makes the card click-through.",
|
||||
Kind::Toggle(true),
|
||||
),
|
||||
Field::new(
|
||||
format!("{prefix}.enabled"),
|
||||
"Show note",
|
||||
"",
|
||||
Kind::Toggle(true),
|
||||
),
|
||||
text(
|
||||
format!("{prefix}.title"),
|
||||
"Title",
|
||||
"Empty hides the title.",
|
||||
"Note",
|
||||
),
|
||||
text(
|
||||
format!("{prefix}.anchor"),
|
||||
"Position",
|
||||
"Nine positions, e.g. top_right or center.",
|
||||
"top_right",
|
||||
),
|
||||
text(
|
||||
format!("{prefix}.font_family"),
|
||||
"Font",
|
||||
"Empty follows the desktop font.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
format!("{prefix}.color"),
|
||||
"Text color",
|
||||
"Empty or theme follows the theme; otherwise #RRGGBB / #RRGGBBAA.",
|
||||
"",
|
||||
),
|
||||
text(
|
||||
format!("{prefix}.background"),
|
||||
"Background",
|
||||
"theme follows the palette; empty is transparent; otherwise hex color.",
|
||||
"theme",
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.width"),
|
||||
"Width",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
320.0,
|
||||
120.0,
|
||||
1200.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.height"),
|
||||
"Height",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
240.0,
|
||||
80.0,
|
||||
1200.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.margin_x"),
|
||||
"Horizontal margin",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
48.0,
|
||||
0.0,
|
||||
1000.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.margin_y"),
|
||||
"Vertical margin",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
80.0,
|
||||
0.0,
|
||||
1000.0,
|
||||
1.0,
|
||||
" px",
|
||||
true,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.text_size"),
|
||||
"Text size",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
16.0,
|
||||
8.0,
|
||||
96.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.title_size"),
|
||||
"Title size",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
18.0,
|
||||
8.0,
|
||||
96.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.opacity"),
|
||||
"Opacity",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
0.9,
|
||||
0.0,
|
||||
1.0,
|
||||
0.05,
|
||||
"",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.padding"),
|
||||
"Padding",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
20.0,
|
||||
0.0,
|
||||
64.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.gap"),
|
||||
"Title spacing",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
8.0,
|
||||
0.0,
|
||||
64.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
range(
|
||||
format!("{prefix}.radius"),
|
||||
"Corner radius",
|
||||
"Logical pixels; centered axes ignore margins.",
|
||||
16.0,
|
||||
0.0,
|
||||
128.0,
|
||||
1.0,
|
||||
" px",
|
||||
false,
|
||||
),
|
||||
Field::new(
|
||||
format!("{prefix}.alignment"),
|
||||
"Text alignment",
|
||||
"",
|
||||
Kind::Choice {
|
||||
default: "left",
|
||||
choices: &[("left", "Left"), ("center", "Center"), ("right", "Right")],
|
||||
},
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
pub fn fields(page: Page) -> Vec<Field> {
|
||||
match page {
|
||||
Page::Appearance => vec![
|
||||
@@ -240,6 +606,7 @@ pub fn fields(page: Page) -> Vec<Field> {
|
||||
&[("fill", "Fill"), ("fit", "Fit")],
|
||||
),
|
||||
],
|
||||
Page::Desktop => clock_fields(),
|
||||
Page::Bar => vec![
|
||||
range(
|
||||
"theme.geometry.top_bar_height",
|
||||
|
||||
Reference in new issue
Block a user