git.lucas.co / cce-system-interface
system settings
git clone https://git.lucas.co/cce-system-interface.git

commit2e0e99910a19d18abfdce47e1245f1b63f71f9d0
parentb1f1e12ca6
authorLucas Galante <[email protected]>
date2026-06-24 23:09
refactor: rename Window widget to Backplate to avoid OS window naming collision

 src/input_handler.rs   |  5 ++-
 src/main.rs            | 12 +++----
 src/pages/interface.rs | 92 +++++++++++++++++++++++++-------------------------
 src/renderer.rs        | 14 ++++----
 4 files changed, 63 insertions(+), 60 deletions(-)

diff --git a/src/input_handler.rs b/src/input_handler.rs
index dfd3520..0180dd2 100644
--- a/src/input_handler.rs
+++ b/src/input_handler.rs
@@ -237,7 +237,7 @@ impl SystemInterface {
                             14 => pages::interface::InterfaceMessage::SetBreadcrumbBgColor(cp.color),
                             15 => pages::interface::InterfaceMessage::SetPopoverBgColor(cp.color),
                             16 => pages::interface::InterfaceMessage::SetNotificationBgColor(cp.color),
-                            17 => pages::interface::InterfaceMessage::SetWindowColor(cp.color),
+                            17 => pages::interface::InterfaceMessage::SetBackplateColor(cp.color),
                             18 => pages::interface::InterfaceMessage::SetPageColor(cp.color),
                             19 => pages::interface::InterfaceMessage::SetLayerColor(cp.color),
                             20 => pages::interface::InterfaceMessage::SetScrollingListEntryBgColor([cp.color[0], cp.color[1], cp.color[2], cp.alpha]),
@@ -322,6 +322,9 @@ impl SystemInterface {
                 if self.app.interface.plate_corner_radius_spinbox.take_change() {
                     actions.push(AppAction::Interface(pages::interface::InterfaceMessage::SetPlateCornerRadius(self.app.interface.plate_corner_radius_spinbox.value as u16)));
                 }
+                if self.app.interface.backplate_corner_radius_spinbox.take_change() {
+                    actions.push(AppAction::Interface(pages::interface::InterfaceMessage::SetBackplateCornerRadius(self.app.interface.backplate_corner_radius_spinbox.value as u16)));
+                }
                 if self.app.interface.page_opacity_spinbox.take_change() {
                     actions.push(AppAction::Interface(pages::interface::InterfaceMessage::SetPageOpacity(self.app.interface.page_opacity_spinbox.value as f32 / 100.0)));
                 }
diff --git a/src/main.rs b/src/main.rs
index 42f31b6..8e1483f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -204,7 +204,7 @@ struct SystemInterface {
     audio_source_dragging: Option<usize>,
     display_brightness_dragging: bool,
     page_sec_containers: Vec<cce_ui::widget::Container>,
-    root_window: cce_ui::widget::Window,
+    root_window: cce_ui::widget::Backplate,
     menubar: cce_ui::widget::Paginator,
     switcher: cce_ui::widget::Switcher,
     pages: Vec<cce_ui::widget::Page>,
@@ -251,9 +251,9 @@ impl cce_ui::engine::Application for SystemInterface {
         let mut app_state = app;
         app_state.current_page = Page::ALL[initial_page_idx];
 
-        let win_color = app_state.interface.window_color;
+        let win_color = app_state.interface.backplate_color;
         let win_opacity = 1.0f32;
-        let win_radius = app_state.interface.window_corner_radius;
+        let win_radius = app_state.interface.backplate_corner_radius;
 
         let mut font_system = FontSystem::new();
         font_system.db_mut().load_fonts_dir("/home/lsgalante/Dropbox/Fonts");
@@ -304,7 +304,7 @@ impl cce_ui::engine::Application for SystemInterface {
             audio_source_dragging: None,
             display_brightness_dragging: false,
             page_sec_containers: Vec::new(),
-            root_window: cce_ui::widget::Window::new(0.0, 0.0, 820.0, 680.0)
+            root_window: cce_ui::widget::Backplate::new(0.0, 0.0, 820.0, 680.0)
                 .with_background([
                     win_color[0] as f32 / 255.0,
                     win_color[1] as f32 / 255.0,
@@ -541,7 +541,7 @@ fn collect_popover_rects(w: &dyn cce_ui::widget::Element, popovers: &mut Vec<(f3
                 14 => self.app.interface.breadcrumb_bg_color,
                 15 => self.app.interface.popover_bg_color,
                 16 => self.app.interface.notification_bg_color,
-                17 => self.app.interface.window_color,
+                17 => self.app.interface.backplate_color,
                 18 => self.app.interface.page_color,
                 19 => self.app.interface.layer_color,
                 22 => self.app.interface.status_box_background_color,
@@ -594,7 +594,7 @@ fn collect_popover_rects(w: &dyn cce_ui::widget::Element, popovers: &mut Vec<(f3
                     14 => pages::interface::InterfaceMessage::SetBreadcrumbBgColor(cp.color),
                     15 => pages::interface::InterfaceMessage::SetPopoverBgColor(cp.color),
                     16 => pages::interface::InterfaceMessage::SetNotificationBgColor(cp.color),
-                    17 => pages::interface::InterfaceMessage::SetWindowColor(cp.color),
+                    17 => pages::interface::InterfaceMessage::SetBackplateColor(cp.color),
                     18 => pages::interface::InterfaceMessage::SetPageColor(cp.color),
                     19 => pages::interface::InterfaceMessage::SetLayerColor(cp.color),
                     22 => pages::interface::InterfaceMessage::SetStatusBoxBackgroundColor(cp.color),
diff --git a/src/pages/interface.rs b/src/pages/interface.rs
index 5dada46..7e867ff 100644
--- a/src/pages/interface.rs
+++ b/src/pages/interface.rs
@@ -255,9 +255,9 @@ pub struct InterfaceState {
     pub notification_bg_color: [u8; 3],
     pub notification_opacity: f32,
     pub notification_opacity_spinbox: Spinbox,
-    pub window_color: [u8; 3],
-    pub window_corner_radius: u16,
-    pub window_corner_radius_spinbox: Spinbox,
+    pub backplate_color: [u8; 3],
+    pub backplate_corner_radius: u16,
+    pub backplate_corner_radius_spinbox: Spinbox,
     pub paginator_tab_padding_x: u16,
     pub paginator_tab_padding_y: u16,
     pub button_padding: u16,
@@ -421,7 +421,7 @@ impl Default for InterfaceState {
                 ColorSelector::new([81, 81, 97]).with_label("Background").with_config(CONFIG_PATH, "breadcrumb_bg_color"), // 15: Breadcrumb - Background
                 ColorSelector::new([81, 81, 97]).with_label("Background").with_config(CONFIG_PATH, "popover_bg_color"), // 16: Popover - Background
                 ColorSelector::new([0x08, 0x08, 0x0c]).with_label("Background").with_config(CONFIG_PATH, "notification_bg_color"), // 17: Notification - Background
-                ColorSelector::new([0x0a, 0x1a, 0x0e]).with_label("Color").with_config(CONFIG_PATH, "window_color"), // 18: Surfaces - Window Color
+                ColorSelector::new([0x0a, 0x1a, 0x0e]).with_label("Color").with_config(CONFIG_PATH, "backplate_color"), // 18: Surfaces - Backplate Color
                 ColorSelector::new([0, 0, 0]).with_label("Page Color").with_config(CONFIG_PATH, "page_color"), // 19: Containers - Page Color
                 ColorSelector::new([0, 0, 0]).with_label("Layer Color").with_config(CONFIG_PATH, "layer_color"), // 20: Containers - Layer Color
                 ColorSelector::new_rgba([255, 255, 255, 10]).with_label("Entry Background").with_config(CONFIG_PATH, "scrollinglist_entry_bg_color"), // 21: ScrollingList - Entry Background
@@ -548,9 +548,9 @@ impl Default for InterfaceState {
             notification_bg_color: [0x08, 0x08, 0x0c],
             notification_opacity: 0.9,
             notification_opacity_spinbox: Spinbox::new(90, 0, 100, 5).with_label("Opacity").with_unit("%").with_config(CONFIG_PATH, "notification_opacity"),
-            window_color: [0x0a, 0x1a, 0x0e],
-            window_corner_radius: 12,
-            window_corner_radius_spinbox: Spinbox::new(12, 0, 100, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "window_corner_radius"),
+            backplate_color: [0x0a, 0x1a, 0x0e],
+            backplate_corner_radius: 12,
+            backplate_corner_radius_spinbox: Spinbox::new(12, 0, 100, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "backplate_corner_radius"),
             status_box_background_color: [0x15, 0x15, 0x20],
             status_box_corner_radius: 4,
             status_box_corner_radius_spinbox: Spinbox::new(4, 0, 50, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "status_box_corner_radius"),
@@ -586,8 +586,8 @@ pub enum InterfaceMessage {
     SetPopoverBgColor([u8; 3]),
     SetNotificationBgColor([u8; 3]),
     SetNotificationOpacity(f32),
-    SetWindowColor([u8; 3]),
-    SetWindowCornerRadius(u16),
+    SetBackplateColor([u8; 3]),
+    SetBackplateCornerRadius(u16),
     SetButtonPadding(u16),
     SetButtonStripSpacing(u16),
     SetSectionPadding(u16),
@@ -771,8 +771,8 @@ pub fn read_interface_config() -> InterfaceState {
     let menubar_opacity = parse_f32_from(&content, "menubar_opacity", 0.90);
     let notification_bg_color = parse_notifications_color(&content, "bg_color", [0x08, 0x08, 0x0c]);
     let notification_opacity = parse_notifications_opacity(&content);
-    let window_color = parse_surfaces_color(&content, "window_color", [0x0a, 0x1a, 0x0e]);
-    let window_corner_radius = parse_surfaces_u16(&content, "window_corner_radius", 12);
+    let backplate_color = parse_surfaces_color(&content, "backplate_color", [0x0a, 0x1a, 0x0e]);
+    let backplate_corner_radius = parse_surfaces_u16(&content, "backplate_corner_radius", 12);
     let status_box_background_color = parse_color_from_key(&content, "status_box_background_color", [0x15, 0x15, 0x20]);
     let status_box_corner_radius = parse_u16_from(&content, "status_box_corner_radius", 4);
     let status_padding = parse_u16_from(&content, "status_padding", 8);
@@ -816,7 +816,7 @@ pub fn read_interface_config() -> InterfaceState {
             ColorSelector::new(breadcrumb_bg).with_label("Background").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "breadcrumb_bg_color"), // 15: Breadcrumb - Background
             ColorSelector::new(popover_bg).with_label("Background").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "popover_bg_color"), // 16: Popover - Background
             ColorSelector::new(notification_bg_color).with_label("Background").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "notification_bg_color"), // 17: Notification - Background
-            ColorSelector::new(window_color).with_label("Color").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "window_color"), // 18: Surfaces - Window Color
+            ColorSelector::new(backplate_color).with_label("Color").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "backplate_color"), // 18: Surfaces - Backplate Color
             ColorSelector::new(page_color).with_label("Page Color").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "page_color"), // 19: Containers - Page Color
             ColorSelector::new(layer_color).with_label("Layer Color").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "layer_color"), // 20: Containers - Layer Color
             ColorSelector::new_rgba(scrollinglist_entry_bg).with_label("Entry Background").with_font_family(&color_selector_font).with_config(CONFIG_PATH, "scrollinglist_entry_bg_color"), // 21: ScrollingList - Entry Background
@@ -949,9 +949,9 @@ pub fn read_interface_config() -> InterfaceState {
         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("%").with_config(CONFIG_PATH, "notification_opacity"),
-        window_color,
-        window_corner_radius,
-        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"),
+        backplate_color,
+        backplate_corner_radius,
+        backplate_corner_radius_spinbox: Spinbox::new(backplate_corner_radius as i32, 0, 100, 1).with_label("Corner Radius").with_unit("px").with_config(CONFIG_PATH, "backplate_corner_radius"),
         custom_multicontrol: MultiControl::new("custom_parameters".to_string()).with_label("custom_parameters"),
     }
 }
@@ -1925,9 +1925,9 @@ fn apply_notifications_opacity(opacity: f32) {
     send_ipc_command("reload");
 }
 
-fn apply_window_color(rgb: [u8; 3]) {
+fn apply_backplate_color(rgb: [u8; 3]) {
     let hex = format!("\"#{:02x}{:02x}{:02x}\"", rgb[0], rgb[1], rgb[2]);
-    write_surfaces_config_value("window_color", &hex);
+    write_surfaces_config_value("backplate_color", &hex);
     send_ipc_command("reload");
 }
 
@@ -1954,10 +1954,10 @@ fn apply_status_module_spacing(spacing: u16) {
 
 
 
-fn apply_window_corner_radius(radius: u16) {
-    write_surfaces_config_value("window_corner_radius", &radius.to_string());
+fn apply_backplate_corner_radius(radius: u16) {
+    write_surfaces_config_value("backplate_corner_radius", &radius.to_string());
     send_ipc_command("reload");
-    cce_ui::color::set_window_corner_radius(radius as f32);
+    cce_ui::color::set_backplate_corner_radius(radius as f32);
 }
 
 
@@ -2784,13 +2784,13 @@ pub fn view(state: &mut InterfaceState, cx: f32, cy: f32, cw: f32, ch: f32, sec_
     // 6. Surfaces Section
     builder.add_section_with_width(&mut final_pc, cw, "Surfaces", sec_focused.get(6).copied().unwrap_or(false), |sec| {
         sec.spacing(12.0);
-        sec.add_section("Window", false, |subsec| {
+        sec.add_section("Backplate", false, |subsec| {
             subsec.spacing(8.0);
-            state.color_selectors[17].color = state.window_color;
+            state.color_selectors[17].color = state.backplate_color;
             subsec.widget_full(&mut state.color_selectors[17], 40.0, ctx);
             subsec.spacing(8.0);
-            state.window_corner_radius_spinbox.value = state.window_corner_radius as i32;
-            subsec.widget_full(&mut state.window_corner_radius_spinbox, 44.0, ctx);
+            state.backplate_corner_radius_spinbox.value = state.backplate_corner_radius as i32;
+            subsec.widget_full(&mut state.backplate_corner_radius_spinbox, 44.0, ctx);
             subsec.spacing(8.0);
         });
         sec.spacing(12.0);
@@ -3273,15 +3273,15 @@ pub fn update(state: &mut InterfaceState, msg: InterfaceMessage) {
             state.notification_opacity_spinbox.value = (opacity * 100.0).round() as i32;
             apply_notifications_opacity(opacity);
         }
-        InterfaceMessage::SetWindowColor(rgb) => {
-            state.window_color = rgb;
-            apply_window_color(rgb);
+        InterfaceMessage::SetBackplateColor(rgb) => {
+            state.backplate_color = rgb;
+            apply_backplate_color(rgb);
         }
 
-        InterfaceMessage::SetWindowCornerRadius(radius) => {
-            state.window_corner_radius = radius;
-            state.window_corner_radius_spinbox.value = radius as i32;
-            apply_window_corner_radius(radius);
+        InterfaceMessage::SetBackplateCornerRadius(radius) => {
+            state.backplate_corner_radius = radius;
+            state.backplate_corner_radius_spinbox.value = radius as i32;
+            apply_backplate_corner_radius(radius);
         }
         InterfaceMessage::SetStatusBoxBackgroundColor(rgb) => {
             state.status_box_background_color = rgb;
@@ -3578,7 +3578,7 @@ pub fn update(state: &mut InterfaceState, msg: InterfaceMessage) {
             let was_lm_hovered = state.label_margin_spinbox.hovered();
             let was_mo_hovered = state.menubar_opacity_spinbox.hovered();
             let was_no_hovered = state.notification_opacity_spinbox.hovered();
-            let was_wcr_hovered = state.window_corner_radius_spinbox.hovered();
+            let was_wcr_hovered = state.backplate_corner_radius_spinbox.hovered();
             // Preserve typeface fields
             let typeface_loaded = state.typeface_loaded;
             let sans_serif = state.sans_serif.clone();
@@ -3642,7 +3642,7 @@ pub fn update(state: &mut InterfaceState, msg: InterfaceMessage) {
             state.label_margin_spinbox.set_hovered(was_lm_hovered);
             state.menubar_opacity_spinbox.set_hovered(was_mo_hovered);
             state.notification_opacity_spinbox.set_hovered(was_no_hovered);
-            state.window_corner_radius_spinbox.set_hovered(was_wcr_hovered);
+            state.backplate_corner_radius_spinbox.set_hovered(was_wcr_hovered);
             state.status_padding_spinbox.set_hovered(was_sp_pad_hovered);
             state.status_module_spacing_spinbox.set_hovered(was_sp_spc_hovered);
 
@@ -4290,7 +4290,7 @@ mod tests {
         use cce_ui::widget::Element;
         let mut state = InterfaceState::default();
         let mut ctx = cce_ui::context::UiContext::new();
-        let sb = &mut state.window_corner_radius_spinbox;
+        let sb = &mut state.backplate_corner_radius_spinbox;
         sb.set_rect(0.0, 0.0, 100.0, 44.0);
         let res = sb.mouse_input(
             cce_ui::widget::MouseButton::Right,
@@ -5400,27 +5400,27 @@ mod tests {
 
         // 2. Parse opacity/color when missing (should return defaults)
         let content = fs::read_to_string(path_str).unwrap();
-        let color = parse_surfaces_color(&content, "window_color", [0x0a, 0x1a, 0x0e]);
+        let color = parse_surfaces_color(&content, "backplate_color", [0x0a, 0x1a, 0x0e]);
         assert_eq!(color, [0x0a, 0x1a, 0x0e]);
-        let radius = parse_surfaces_u16(&content, "window_corner_radius", 12);
+        let radius = parse_surfaces_u16(&content, "backplate_corner_radius", 12);
         assert_eq!(radius, 12);
 
-        // 5. Write surfaces window_color config
-        write_surfaces_config_value_path(path_str, "window_color", "\"#112233\"");
+        // 5. Write surfaces backplate_color config
+        write_surfaces_config_value_path(path_str, "backplate_color", "\"#112233\"");
         let updated2 = fs::read_to_string(path_str).unwrap();
-        assert!(updated2.contains("\"window_color\": \"#112233\""));
+        assert!(updated2.contains("\"backplate_color\": \"#112233\""));
 
-        // 6. Parse surfaces window_color when present
-        let color2 = parse_surfaces_color(&updated2, "window_color", [0, 0, 0]);
+        // 6. Parse surfaces backplate_color when present
+        let color2 = parse_surfaces_color(&updated2, "backplate_color", [0, 0, 0]);
         assert_eq!(color2, [17, 34, 51]);
 
-        // 7. Write surfaces window_corner_radius config
-        write_surfaces_config_value_path(path_str, "window_corner_radius", "16");
+        // 7. Write surfaces backplate_corner_radius config
+        write_surfaces_config_value_path(path_str, "backplate_corner_radius", "16");
         let updated3 = fs::read_to_string(path_str).unwrap();
-        assert!(updated3.contains("\"window_corner_radius\": 16"));
+        assert!(updated3.contains("\"backplate_corner_radius\": 16"));
 
-        // 8. Parse surfaces window_corner_radius when present
-        let radius2 = parse_surfaces_u16(&updated3, "window_corner_radius", 12);
+        // 8. Parse surfaces backplate_corner_radius when present
+        let radius2 = parse_surfaces_u16(&updated3, "backplate_corner_radius", 12);
         assert_eq!(radius2, 16);
 
         // 9. Write surfaces desktop_background config
diff --git a/src/renderer.rs b/src/renderer.rs
index 3733cdd..ea7e7e4 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -137,8 +137,8 @@ impl SystemInterface {
         self.app.interface.button_corner_radius_spinbox.set_parent(None, &mut self.ui_context);
         self.app.interface.notification_opacity_spinbox.clear_children(&mut self.ui_context);
         self.app.interface.notification_opacity_spinbox.set_parent(None, &mut self.ui_context);
-        self.app.interface.window_corner_radius_spinbox.clear_children(&mut self.ui_context);
-        self.app.interface.window_corner_radius_spinbox.set_parent(None, &mut self.ui_context);
+        self.app.interface.backplate_corner_radius_spinbox.clear_children(&mut self.ui_context);
+        self.app.interface.backplate_corner_radius_spinbox.set_parent(None, &mut self.ui_context);
         self.app.interface.custom_multicontrol.clear_children(&mut self.ui_context);
         self.app.interface.custom_multicontrol.set_parent(None, &mut self.ui_context);
         self.app.interface.status_box_corner_radius_spinbox.clear_children(&mut self.ui_context);
@@ -381,7 +381,7 @@ impl SystemInterface {
                 
                 // Section 6: Surfaces
                 link_parent_child(&mut self.page_sec_containers[6], &mut self.app.interface.color_selectors[17], &mut self.ui_context);
-                link_parent_child(&mut self.page_sec_containers[6], &mut self.app.interface.window_corner_radius_spinbox, &mut self.ui_context);
+                link_parent_child(&mut self.page_sec_containers[6], &mut self.app.interface.backplate_corner_radius_spinbox, &mut self.ui_context);
                 // (Plate child widgets)
                 link_parent_child(&mut self.page_sec_containers[6], &mut self.app.interface.color_selectors[0], &mut self.ui_context);
                 link_parent_child(&mut self.page_sec_containers[6], &mut self.app.interface.plate_padding_spinbox, &mut self.ui_context);
@@ -608,12 +608,12 @@ impl SystemInterface {
 
         // Update root window size, background color, opacity, corner radius, and children
         self.root_window.set_rect(0.0, 0.0, sw / s, sh / s);
-        let win_r = self.app.interface.window_color[0] as f32 / 255.0;
-        let win_g = self.app.interface.window_color[1] as f32 / 255.0;
-        let win_b = self.app.interface.window_color[2] as f32 / 255.0;
+        let win_r = self.app.interface.backplate_color[0] as f32 / 255.0;
+        let win_g = self.app.interface.backplate_color[1] as f32 / 255.0;
+        let win_b = self.app.interface.backplate_color[2] as f32 / 255.0;
         let win_a = 1.0f32;
         self.root_window.background_color = Some(cce_ui::color::to_linear([win_r, win_g, win_b, win_a]));
-        self.root_window.radius = self.app.interface.window_corner_radius as f32;
+        self.root_window.radius = self.app.interface.backplate_corner_radius as f32;
         self.root_window.clear_children(&mut self.ui_context);
         self.root_window.add_child(self.menubar.as_ptr(), &mut self.ui_context);
         self.root_window.add_child(self.switcher.as_ptr(), &mut self.ui_context);