system settings
git clone https://git.lucas.co/cce-system-interface.git
Fix: config metadata missing for recreated controls in page fetch functions
src/pages/display.rs | 10 ++--
src/pages/input.rs | 36 +++++++-------
src/pages/interface.rs | 125 ++++++++++++++++++++++++-----------------------
src/pages/system_info.rs | 13 ++---
4 files changed, 95 insertions(+), 89 deletions(-)
diff --git a/src/pages/display.rs b/src/pages/display.rs
index 93d118a..1c3d612 100644
--- a/src/pages/display.rs
+++ b/src/pages/display.rs
@@ -164,18 +164,20 @@ pub async fn fetch_display_state() -> DisplayState {
.with_font_size(13.0)
.with_color([0xd4, 0xd4, 0xd4]),
screensaver_enable,
- screensaver_enable_toggle: Toggle::new().with_label("Enable Screensaver"),
+ screensaver_enable_toggle: Toggle::new().with_label("Enable Screensaver").with_config(CONFIG_PATH, "enable"),
screensaver_timeout,
screensaver_timeout_spinbox: Spinbox::new(screensaver_timeout, 1, 120, 1)
.with_label("Screensaver Timeout")
- .with_unit("m"),
+ .with_unit("m")
+ .with_config(CONFIG_PATH, "timeout"),
screensaver_lock_screen,
- screensaver_lock_screen_toggle: Toggle::new().with_label("Lock Screen on Activation"),
+ screensaver_lock_screen_toggle: Toggle::new().with_label("Lock Screen on Activation").with_config(CONFIG_PATH, "lock_screen"),
screensaver_style: screensaver_style.clone(),
screensaver_style_menu: Dropdown::new(
vec!["Blank".to_string(), "Starfield".to_string(), "Matrix Rain".to_string()],
style_idx,
- ).with_label("Screensaver Style"),
+ ).with_label("Screensaver Style")
+ .with_config(CONFIG_PATH, "style"),
}
}
diff --git a/src/pages/input.rs b/src/pages/input.rs
index 1c91616..1238388 100644
--- a/src/pages/input.rs
+++ b/src/pages/input.rs
@@ -237,9 +237,9 @@ pub fn read_input_config() -> InputState {
tap_to_click: tap,
repeat_rate: rate,
repeat_delay: delay,
- rate_spinbox: Spinbox::new(rate as i32, 1, 100, 1).with_label("Repeat Rate").with_unit("ms"),
- delay_spinbox: Spinbox::new(delay as i32, 100, 2000, 10).with_label("Repeat Delay").with_unit("ms"),
- tap_toggle: Toggle::new().with_label("Tap to Click"),
+ rate_spinbox: Spinbox::new(rate as i32, 1, 100, 1).with_label("Repeat Rate").with_unit("ms").with_config(CONFIG_PATH, "rate"),
+ delay_spinbox: Spinbox::new(delay as i32, 100, 2000, 10).with_label("Repeat Delay").with_unit("ms").with_config(CONFIG_PATH, "delay"),
+ tap_toggle: Toggle::new().with_label("Tap to Click").with_config(CONFIG_PATH, "tap_to_click"),
keybinds: parse_keybinds(&content),
fingers: Vec::new(),
trackpad: Trackpad::new(),
@@ -251,36 +251,36 @@ pub fn read_input_config() -> InputState {
inertial_trackpad,
trackpad_friction,
- scroll_toggle: Toggle::new().with_label("Inertial Scroll"),
- scroll_friction_spinbox: Spinbox::new(scroll_friction as i32, 50, 99, 1).with_label("Scroll Friction").with_unit("%"),
- pointer_toggle: Toggle::new().with_label("Inertial Pointer (Trackpoint)"),
- pointer_friction_spinbox: Spinbox::new(pointer_friction as i32, 50, 99, 1).with_label("Pointer Friction").with_unit("%"),
- trackpad_toggle: Toggle::new().with_label("Inertial Pointer (Trackpad)"),
- trackpad_friction_spinbox: Spinbox::new(trackpad_friction as i32, 50, 99, 1).with_label("Trackpad Friction").with_unit("%"),
+ scroll_toggle: Toggle::new().with_label("Inertial Scroll").with_config(CONFIG_PATH, "inertial_scroll"),
+ scroll_friction_spinbox: Spinbox::new(scroll_friction as i32, 50, 99, 1).with_label("Scroll Friction").with_unit("%").with_config(CONFIG_PATH, "scroll_friction"),
+ pointer_toggle: Toggle::new().with_label("Inertial Pointer (Trackpoint)").with_config(CONFIG_PATH, "inertial_pointer"),
+ pointer_friction_spinbox: Spinbox::new(pointer_friction as i32, 50, 99, 1).with_label("Pointer Friction").with_unit("%").with_config(CONFIG_PATH, "pointer_friction"),
+ trackpad_toggle: Toggle::new().with_label("Inertial Pointer (Trackpad)").with_config(CONFIG_PATH, "inertial_trackpad"),
+ trackpad_friction_spinbox: Spinbox::new(trackpad_friction as i32, 50, 99, 1).with_label("Trackpad Friction").with_unit("%").with_config(CONFIG_PATH, "trackpad_friction"),
natural_scroll,
scroll_speed,
- natural_toggle: Toggle::new().with_label("Natural Scroll"),
- scroll_speed_spinbox: Spinbox::new(scroll_speed_val, 1, 100, 1).with_label("Scroll Speed").with_unit("x").with_decimals(1),
+ natural_toggle: Toggle::new().with_label("Natural Scroll").with_config(CONFIG_PATH, "natural_scroll"),
+ scroll_speed_spinbox: Spinbox::new(scroll_speed_val, 1, 100, 1).with_label("Scroll Speed").with_unit("x").with_decimals(1).with_config(CONFIG_PATH, "scroll_speed"),
dwtp,
trackpoint_accel_speed,
trackpoint_accel_profile,
- dwtp_toggle: Toggle::new().with_label("Disable While Trackpointing"),
- trackpoint_accel_speed_spinbox: Spinbox::new(speed_val, -10, 10, 1).with_label("Acceleration Speed").with_decimals(1),
- trackpoint_accel_profile_menu: Dropdown::new(vec!["flat".to_string(), "adaptive".to_string()], profile_idx).with_label("Acceleration Profile"),
+ dwtp_toggle: Toggle::new().with_label("Disable While Trackpointing").with_config(CONFIG_PATH, "dwtp"),
+ trackpoint_accel_speed_spinbox: Spinbox::new(speed_val, -10, 10, 1).with_label("Acceleration Speed").with_decimals(1).with_config(CONFIG_PATH, "trackpoint_accel_speed"),
+ trackpoint_accel_profile_menu: Dropdown::new(vec!["flat".to_string(), "adaptive".to_string()], profile_idx).with_label("Acceleration Profile").with_config(CONFIG_PATH, "trackpoint_accel_profile"),
// Cursor settings
cursor_theme: cursor_theme.clone(),
cursor_size: cursor_size as u32,
- cursor_theme_menu: Dropdown::new(cursor_themes.clone(), theme_idx).with_label("Cursor Theme"),
- cursor_size_spinbox: Spinbox::new(cursor_size as i32, 16, 64, 4).with_label("Cursor Size").with_unit("px"),
+ cursor_theme_menu: Dropdown::new(cursor_themes.clone(), theme_idx).with_label("Cursor Theme").with_config(CONFIG_PATH, "cursor_theme"),
+ cursor_size_spinbox: Spinbox::new(cursor_size as i32, 16, 64, 4).with_label("Cursor Size").with_unit("px").with_config(CONFIG_PATH, "cursor_size"),
cursor_themes,
// Graph settings
- zoom_in_box: TextBox::new(zoom_in).with_label("Zoom In"),
- zoom_out_box: TextBox::new(zoom_out).with_label("Zoom Out"),
+ zoom_in_box: TextBox::new(zoom_in).with_label("Zoom In").with_config(CONFIG_PATH, "zoom_in"),
+ zoom_out_box: TextBox::new(zoom_out).with_label("Zoom Out").with_config(CONFIG_PATH, "zoom_out"),
// Keyboard bindings widget
keybinds_control: KeybindsControl::new(),
diff --git a/src/pages/interface.rs b/src/pages/interface.rs
index c41943d..86e7bc7 100644
--- a/src/pages/interface.rs
+++ b/src/pages/interface.rs
@@ -754,70 +754,70 @@ pub fn read_interface_config() -> InterfaceState {
paginator_tab_padding_x,
paginator_tab_padding_y,
button_padding,
- button_padding_spinbox: Spinbox::new(button_padding as i32, 0, 100, 1).with_label("Button Padding").with_unit("px"),
+ button_padding_spinbox: Spinbox::new(button_padding as i32, 0, 100, 1).with_label("Button Padding").with_unit("px").with_config(CONFIG_PATH, "button_padding"),
button_strip_spacing,
- button_strip_spacing_spinbox: Spinbox::new(button_strip_spacing as i32, 0, 100, 1).with_label("Spacing").with_unit("px"),
+ button_strip_spacing_spinbox: Spinbox::new(button_strip_spacing as i32, 0, 100, 1).with_label("Spacing").with_unit("px").with_config(CONFIG_PATH, "button_strip_spacing"),
section_padding,
- section_padding_spinbox: Spinbox::new(section_padding as i32, 0, 100, 1).with_label("Padding").with_unit("px"),
+ section_padding_spinbox: Spinbox::new(section_padding as i32, 0, 100, 1).with_label("Padding").with_unit("px").with_config(CONFIG_PATH, "section_padding"),
plate_padding,
- plate_padding_spinbox: Spinbox::new(plate_padding as i32, 0, 100, 1).with_label("Padding").with_unit("px"),
+ plate_padding_spinbox: Spinbox::new(plate_padding as i32, 0, 100, 1).with_label("Padding").with_unit("px").with_config(CONFIG_PATH, "plate_padding"),
plate_opacity,
- plate_opacity_spinbox: Spinbox::new((plate_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ plate_opacity_spinbox: Spinbox::new((plate_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "plate_opacity"),
plate_corner_radius,
- plate_corner_radius_spinbox: Spinbox::new(plate_corner_radius as i32, 0, 50, 1).with_label("Corner Radius").with_unit("px"),
+ plate_corner_radius_spinbox: Spinbox::new(plate_corner_radius as i32, 0, 50, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "plate_corner_radius"),
page_color,
page_opacity,
- page_opacity_spinbox: Spinbox::new((page_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ page_opacity_spinbox: Spinbox::new((page_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "page_opacity"),
layer_color,
layer_opacity,
- layer_opacity_spinbox: Spinbox::new((layer_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ layer_opacity_spinbox: Spinbox::new((layer_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "layer_opacity"),
page_margin,
- page_margin_spinbox: Spinbox::new(page_margin as i32, 0, 100, 1).with_label("Page Margin").with_unit("px"),
+ page_margin_spinbox: Spinbox::new(page_margin as i32, 0, 100, 1).with_label("Page Margin").with_unit("px").with_config(CONFIG_PATH, "page_margin"),
grid_min_col_width,
- grid_min_col_width_spinbox: Spinbox::new(grid_min_col_width as i32, 100, 1000, 10).with_label("Minimum Width").with_unit("px"),
+ grid_min_col_width_spinbox: Spinbox::new(grid_min_col_width as i32, 100, 1000, 10).with_label("Minimum Width").with_unit("px").with_config(CONFIG_PATH, "grid_min_col_width"),
spinbox_height,
- spinbox_height_spinbox: Spinbox::new(spinbox_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ spinbox_height_spinbox: Spinbox::new(spinbox_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "spinbox_height"),
spinbox_corner_radius,
- spinbox_corner_radius_spinbox: Spinbox::new(spinbox_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px"),
+ spinbox_corner_radius_spinbox: Spinbox::new(spinbox_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px").with_config(CONFIG_PATH, "spinbox_corner_radius"),
toggle_height,
- toggle_height_spinbox: Spinbox::new(toggle_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ toggle_height_spinbox: Spinbox::new(toggle_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "toggle_height"),
toggle_corner_radius,
- toggle_corner_radius_spinbox: Spinbox::new(toggle_corner_radius as i32, 0, 50, 1).with_label("Corner Radius").with_unit("px"),
+ toggle_corner_radius_spinbox: Spinbox::new(toggle_corner_radius as i32, 0, 50, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "toggle_corner_radius"),
color_selector_height,
- color_selector_height_spinbox: Spinbox::new(color_selector_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ color_selector_height_spinbox: Spinbox::new(color_selector_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "color_selector_height"),
color_selector_corner_radius,
- color_selector_corner_radius_spinbox: Spinbox::new(color_selector_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px"),
+ color_selector_corner_radius_spinbox: Spinbox::new(color_selector_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px").with_config(CONFIG_PATH, "color_selector_corner_radius"),
color_selector_preview_corner_radius,
- color_selector_preview_corner_radius_spinbox: Spinbox::new(color_selector_preview_corner_radius as i32, 0, 50, 1).with_label("Preview Corner Radius").with_unit("px"),
+ color_selector_preview_corner_radius_spinbox: Spinbox::new(color_selector_preview_corner_radius as i32, 0, 50, 1).with_label("Preview Corner Radius").with_unit("px").with_config(CONFIG_PATH, "color_selector_preview_corner_radius"),
color_selector_preview_margin,
- color_selector_preview_margin_spinbox: Spinbox::new(color_selector_preview_margin as i32, 0, 20, 1).with_label("Preview Margin").with_unit("px"),
+ color_selector_preview_margin_spinbox: Spinbox::new(color_selector_preview_margin as i32, 0, 20, 1).with_label("Preview Margin").with_unit("px").with_config(CONFIG_PATH, "color_selector_preview_margin"),
textbox_height,
- textbox_height_spinbox: Spinbox::new(textbox_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ textbox_height_spinbox: Spinbox::new(textbox_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "textbox_height"),
textbox_corner_radius,
- textbox_corner_radius_spinbox: Spinbox::new(textbox_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px"),
+ textbox_corner_radius_spinbox: Spinbox::new(textbox_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px").with_config(CONFIG_PATH, "textbox_corner_radius"),
slider_height,
- slider_height_spinbox: Spinbox::new(slider_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ slider_height_spinbox: Spinbox::new(slider_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "slider_height"),
font_selector_height,
- font_selector_height_spinbox: Spinbox::new(font_selector_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ font_selector_height_spinbox: Spinbox::new(font_selector_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "font_selector_height"),
font_selector_corner_radius,
- font_selector_corner_radius_spinbox: Spinbox::new(font_selector_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px"),
+ font_selector_corner_radius_spinbox: Spinbox::new(font_selector_corner_radius as i32, 0, 50, 1).with_label("Border Radius").with_unit("px").with_config(CONFIG_PATH, "font_selector_corner_radius"),
dropdown_height,
- dropdown_height_spinbox: Spinbox::new(dropdown_height as i32, 10, 100, 1).with_label("Height").with_unit("px"),
+ dropdown_height_spinbox: Spinbox::new(dropdown_height as i32, 10, 100, 1).with_label("Height").with_unit("px").with_config(CONFIG_PATH, "dropdown_height"),
dropdown_corner_radius,
- dropdown_corner_radius_spinbox: Spinbox::new(dropdown_corner_radius as i32, 0, 50, 1).with_label("Radius").with_unit("px"),
+ dropdown_corner_radius_spinbox: Spinbox::new(dropdown_corner_radius as i32, 0, 50, 1).with_label("Radius").with_unit("px").with_config(CONFIG_PATH, "dropdown_corner_radius"),
button_corner_radius,
- button_corner_radius_spinbox: Spinbox::new(button_corner_radius as i32, 0, 50, 1).with_label("Radius").with_unit("px"),
+ button_corner_radius_spinbox: Spinbox::new(button_corner_radius as i32, 0, 50, 1).with_label("Radius").with_unit("px").with_config(CONFIG_PATH, "button_corner_radius"),
nested_section_label_alignment,
label_alignment_menu: Dropdown::new(
vec!["Left".to_string(), "Center".to_string(), "Right".to_string()],
nested_section_label_alignment as usize,
- ).with_label("Label Alignment"),
+ ).with_label("Label Alignment").with_config(CONFIG_PATH, "nested_section_label_alignment"),
nested_section_label_offset,
- label_offset_spinbox: Spinbox::new(nested_section_label_offset as i32, -100, 100, 1).with_label("Label Offset").with_unit("px"),
+ label_offset_spinbox: Spinbox::new(nested_section_label_offset as i32, -100, 100, 1).with_label("Label Offset").with_unit("px").with_config(CONFIG_PATH, "nested_section_label_offset"),
label_margin,
- label_margin_spinbox: Spinbox::new(label_margin as i32, 0, 100, 1).with_label("Label Margin").with_unit("px"),
+ label_margin_spinbox: Spinbox::new(label_margin as i32, 0, 100, 1).with_label("Label Margin").with_unit("px").with_config(CONFIG_PATH, "label_margin"),
typeface_loaded: false,
sans_serif: String::new(),
serif: String::new(),
@@ -839,42 +839,42 @@ pub fn read_interface_config() -> InterfaceState {
status_menu: Dropdown::default(),
fuzzel_menu: Dropdown::default(),
terminal_menu: Dropdown::default(),
- borders_size_box: Spinbox::new(11, 6, 72, 1),
- status_size_box: Spinbox::new(11, 6, 72, 1),
- fuzzel_size_box: Spinbox::new(14, 6, 72, 1),
- terminal_size_box: Spinbox::new(12, 6, 72, 1),
+ borders_size_box: Spinbox::new(11, 6, 72, 1).with_config(CONFIG_PATH, "border_font_size"),
+ status_size_box: Spinbox::new(11, 6, 72, 1).with_config(CONFIG_PATH, "status_font_size"),
+ fuzzel_size_box: Spinbox::new(14, 6, 72, 1).with_config("/home/lsgalante/.config/fuzzel/fuzzel.ini", "size"),
+ terminal_size_box: Spinbox::new(12, 6, 72, 1).with_config("/home/lsgalante/.config/foot/foot.ini", "size"),
color_selector_font: color_selector_font.clone(),
- color_selector_font_selector: FontSelector::new(color_selector_font.clone()).with_label("Value"),
+ color_selector_font_selector: FontSelector::new(color_selector_font.clone()).with_label("Value").with_config(CONFIG_PATH, "color_selector_font"),
menubar_font: menubar_font.clone(),
- menubar_font_selector: FontSelector::new(menubar_font.clone()).with_label("Font"),
+ menubar_font_selector: FontSelector::new(menubar_font.clone()).with_label("Font").with_config(CONFIG_PATH, "menubar_font"),
section_label_font: section_label_font.clone(),
- section_label_font_selector: FontSelector::new(section_label_font.clone()).with_label("Label"),
+ section_label_font_selector: FontSelector::new(section_label_font.clone()).with_label("Label").with_config(CONFIG_PATH, "section_label_font"),
nested_section_label_font: nested_section_label_font.clone(),
- nested_section_label_font_selector: FontSelector::new(nested_section_label_font.clone()).with_label("Label"),
+ nested_section_label_font_selector: FontSelector::new(nested_section_label_font.clone()).with_label("Label").with_config(CONFIG_PATH, "nested_section_label_font"),
breadcrumb_font: breadcrumb_font.clone(),
- breadcrumb_font_selector: FontSelector::new(breadcrumb_font.clone()).with_label("Font"),
+ breadcrumb_font_selector: FontSelector::new(breadcrumb_font.clone()).with_label("Font").with_config(CONFIG_PATH, "breadcrumb_font"),
graph_show_grid,
- graph_show_grid_toggle: Toggle::new().with_label("Show Grid"),
+ graph_show_grid_toggle: Toggle::new().with_label("Show Grid").with_config(CONFIG_PATH, "graph_show_grid"),
graph_snap_enabled,
- graph_snap_enabled_toggle: Toggle::new().with_label("Grid Snapping"),
+ graph_snap_enabled_toggle: Toggle::new().with_label("Grid Snapping").with_config(CONFIG_PATH, "graph_snap_enabled"),
graph_uniform_background,
- graph_uniform_background_toggle: Toggle::new().with_label("Uniform Background"),
+ graph_uniform_background_toggle: Toggle::new().with_label("Uniform Background").with_config(CONFIG_PATH, "graph_uniform_background"),
graph_cell_opacity,
- graph_cell_opacity_spinbox: Spinbox::new((graph_cell_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Cell Opacity").with_unit("%"),
+ graph_cell_opacity_spinbox: Spinbox::new((graph_cell_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Cell Opacity").with_unit("%").with_config(CONFIG_PATH, "graph_cell_opacity"),
graph_gap_opacity,
- graph_gap_opacity_spinbox: Spinbox::new((graph_gap_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Gap Opacity").with_unit("%"),
+ graph_gap_opacity_spinbox: Spinbox::new((graph_gap_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Gap Opacity").with_unit("%").with_config(CONFIG_PATH, "graph_gap_opacity"),
graph_gap_width,
- graph_gap_width_spinbox: Spinbox::new(graph_gap_width as i32, 0, 100, 1).with_label("Gap Width").with_unit("px"),
+ graph_gap_width_spinbox: Spinbox::new(graph_gap_width as i32, 0, 100, 1).with_label("Gap Width").with_unit("px").with_config(CONFIG_PATH, "graph_gap_width"),
menubar_opacity,
- menubar_opacity_spinbox: Spinbox::new((menubar_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ menubar_opacity_spinbox: Spinbox::new((menubar_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "menubar_opacity"),
notification_bg_color,
notification_opacity,
- notification_opacity_spinbox: Spinbox::new((notification_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ notification_opacity_spinbox: Spinbox::new((notification_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "notification_opacity"),
window_color,
window_opacity,
- window_opacity_spinbox: Spinbox::new((window_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%"),
+ window_opacity_spinbox: Spinbox::new((window_opacity * 100.0).round() as i32, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "window_opacity"),
window_corner_radius,
- window_corner_radius_spinbox: Spinbox::new(window_corner_radius as i32, 0, 100, 1).with_label("Corner Radius").with_unit("px"),
+ window_corner_radius_spinbox: Spinbox::new(window_corner_radius as i32, 0, 100, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "window_corner_radius"),
custom_multicontrol: MultiControl::new("custom_parameters".to_string()).with_label("custom_parameters"),
}
}
@@ -904,6 +904,7 @@ pub fn read_windows_config() -> WindowsState {
let mode_str = &tag_modes[i - 1];
let idx = dropdown_options.iter().position(|opt| opt.to_lowercase() == mode_str.to_lowercase()).unwrap_or(0);
Dropdown::new(dropdown_options.clone(), idx).with_label(&format!("Tag {}", i))
+ .with_config(CONFIG_PATH, "tag_layout")
}).collect();
let side_panel_behavior = parse_string_from(&content, "side_panel_behavior", "inline");
@@ -911,14 +912,16 @@ pub fn read_windows_config() -> WindowsState {
let side_panel_behavior_menu = Dropdown::new(
vec!["Above".to_string(), "Inline".to_string()],
side_panel_behavior_idx,
- ).with_label("Behavior");
+ ).with_label("Behavior")
+ .with_config(CONFIG_PATH, "side_panel_behavior");
let side_panel_position = parse_string_from(&content, "side_panel_position", "left");
let side_panel_position_idx = if side_panel_position == "right" { 1 } else { 0 };
let side_panel_position_menu = Dropdown::new(
vec!["Left".to_string(), "Right".to_string()],
side_panel_position_idx,
- ).with_label("Position");
+ ).with_label("Position")
+ .with_config(CONFIG_PATH, "side_panel_position");
let spw = parse_u16_from(&content, "side_panel_width", 360);
let spbg = parse_u16_from(&content, "side_panel_border_gap", 0);
@@ -942,25 +945,25 @@ pub fn read_windows_config() -> WindowsState {
status_height: sh,
transition_duration: td,
spinboxes: make_spinboxes(fs, ca, g, fl),
- cascade_offset_spinbox: Spinbox::new(co as i32, 0, 200, 1),
- edge_gap_spinbox: Spinbox::new(gl as i32, 0, 200, 1),
- top_gap_spinbox: Spinbox::new(gt as i32, 0, 200, 1),
- grid_gap_spinbox: Spinbox::new(gg as i32, 0, 200, 1),
- status_height_spinbox: Spinbox::new(sh as i32, 0, 100, 1),
- transition_duration_spinbox: Spinbox::new(td as i32, 0, 2000, 50),
+ cascade_offset_spinbox: Spinbox::new(co as i32, 0, 200, 1).with_config(CONFIG_PATH, "cascade_offset"),
+ edge_gap_spinbox: Spinbox::new(gl as i32, 0, 200, 1).with_config(CONFIG_PATH, "edge_gap"),
+ top_gap_spinbox: Spinbox::new(gt as i32, 0, 200, 1).with_config(CONFIG_PATH, "gap_top"),
+ grid_gap_spinbox: Spinbox::new(gg as i32, 0, 200, 1).with_config(CONFIG_PATH, "grid_gap"),
+ status_height_spinbox: Spinbox::new(sh as i32, 0, 100, 1).with_config(CONFIG_PATH, "bar_height"),
+ transition_duration_spinbox: Spinbox::new(td as i32, 0, 2000, 50).with_config(CONFIG_PATH, "transition_duration"),
tag_layout_menus,
side_panel_behavior_menu,
side_panel_position_menu,
side_panel_width: spw,
- side_panel_width_spinbox: Spinbox::new(spw as i32, 0, 2000, 10),
+ side_panel_width_spinbox: Spinbox::new(spw as i32, 0, 2000, 10).with_config(CONFIG_PATH, "side_panel_width"),
side_panel_border_gap: spbg,
- side_panel_border_gap_spinbox: Spinbox::new(spbg as i32, 0, 500, 1),
+ side_panel_border_gap_spinbox: Spinbox::new(spbg as i32, 0, 500, 1).with_config(CONFIG_PATH, "side_panel_border_gap"),
side_panel_border_opacity: spbo,
- side_panel_border_opacity_spinbox: Spinbox::new(spbo as i32, 0, 100, 5),
+ side_panel_border_opacity_spinbox: Spinbox::new(spbo as i32, 0, 100, 5).with_config(CONFIG_PATH, "side_panel_border_opacity"),
transparency_enabled,
- transparency_toggle: Toggle::new().with_label("Transparency"),
+ transparency_toggle: Toggle::new().with_label("Transparency").with_config(CONFIG_PATH, "window_opacity"),
blur_enabled,
- blur_toggle: Toggle::new().with_label("Blur"),
+ blur_toggle: Toggle::new().with_label("Blur").with_config(CONFIG_PATH, "window_blur"),
}
}
diff --git a/src/pages/system_info.rs b/src/pages/system_info.rs
index 3bcf1aa..982bc94 100644
--- a/src/pages/system_info.rs
+++ b/src/pages/system_info.rs
@@ -459,13 +459,14 @@ pub async fn fetch_system_state() -> SystemState {
notifications_loaded: false,
notifications_enable: true,
- notifications_enable_toggle: Toggle::new().with_label("Enable Notifications"),
+ notifications_enable_toggle: Toggle::new().with_label("Enable Notifications").with_config(&get_config_path(), "enable"),
notifications_bell: false,
- notifications_bell_toggle: Toggle::new().with_label("Play Bell Sound"),
+ notifications_bell_toggle: Toggle::new().with_label("Play Bell Sound").with_config(&get_config_path(), "bell"),
notifications_duration: 5,
notifications_duration_spinbox: Spinbox::new(5, 1, 60, 1)
.with_label("Notification Duration")
- .with_unit("s"),
+ .with_unit("s")
+ .with_config(&get_config_path(), "duration"),
status_loaded: false,
status_font_size: 11,
@@ -474,9 +475,9 @@ pub async fn fetch_system_state() -> SystemState {
status_underline: true,
status_running: false,
status_label: Label::new("Status Interface: Stopped").with_font_size(14.0).with_color([170, 51, 51]),
- status_separators_toggle: Toggle::new().with_label("Show Separators"),
- status_underline_toggle: Toggle::new().with_label("Show Underline"),
- status_padding_spinbox: Spinbox::new(8, 0, 32, 1).with_label("Side Padding").with_unit("px"),
+ status_separators_toggle: Toggle::new().with_label("Show Separators").with_config(&get_config_path(), "status_separators"),
+ status_underline_toggle: Toggle::new().with_label("Show Underline").with_config(&get_config_path(), "status_underline"),
+ status_padding_spinbox: Spinbox::new(8, 0, 32, 1).with_label("Side Padding").with_unit("px").with_config(&get_config_path(), "status_padding"),
}
}