git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commite85da7161fc9d34fd564d14d97173b82710f5503
parentf1826a62ab
authorLucas Galante <[email protected]>
date2026-06-29 13:45
Transition from JSON to KDL format configuration

 Cargo.lock     |  2 +-
 Cargo.toml     |  2 +-
 Makefile       |  2 +-
 src/app.rs     | 88 ++++++++++++++++++++++++++++------------------------------
 src/project.rs |  3 +-
 src/window.rs  |  2 +-
 6 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index c4dc04c..1537a4b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -155,7 +155,7 @@ dependencies = [
 ]
 
 [[package]]
-name = "cce-design-interface"
+name = "cce-designer"
 version = "0.1.0"
 dependencies = [
  "bytemuck",
diff --git a/Cargo.toml b/Cargo.toml
index 10fcd4d..d9e78e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "cce-design-interface"
+name = "cce-designer"
 version = "0.1.0"
 edition = "2021"
 
diff --git a/Makefile b/Makefile
index d684483..1573570 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ build:
 
 install: build
 	mkdir -p ~/.local/bin
-	install -m 755 ../target/release/cce-design-interface ~/.local/bin/cce-design-interface
+	install -m 755 ../target/release/cce-designer ~/.local/bin/cce-designer
 
 run:
 	cargo run
diff --git a/src/app.rs b/src/app.rs
index 4acb81b..4e2a4b7 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1498,34 +1498,34 @@ impl State {
 
             // Find executable path
             let exe_path = if let Ok(cur_exe) = std::env::current_exe() {
-                let sibling = cur_exe.with_file_name("cce-filesystem-interface");
+                let sibling = cur_exe.with_file_name("cce-files");
                 if sibling.exists() {
                     sibling
                 } else if let Ok(home) = std::env::var("HOME") {
                     let path = std::path::PathBuf::from(home)
                         .join(".local")
                         .join("bin")
-                        .join("cce-filesystem-interface");
+                        .join("cce-files");
                     if path.exists() {
                         path
                     } else {
-                        std::path::PathBuf::from("cce-filesystem-interface")
+                        std::path::PathBuf::from("cce-files")
                     }
                 } else {
-                    std::path::PathBuf::from("cce-filesystem-interface")
+                    std::path::PathBuf::from("cce-files")
                 }
             } else if let Ok(home) = std::env::var("HOME") {
                 let path = std::path::PathBuf::from(home)
                     .join(".local")
                     .join("bin")
-                    .join("cce-filesystem-interface");
+                    .join("cce-files");
                 if path.exists() {
                     path
                 } else {
-                    std::path::PathBuf::from("cce-filesystem-interface")
+                    std::path::PathBuf::from("cce-files")
                 }
             } else {
-                std::path::PathBuf::from("cce-filesystem-interface")
+                std::path::PathBuf::from("cce-files")
             };
 
             let child = match Command::new(exe_path)
@@ -1535,7 +1535,7 @@ impl State {
             {
                 Ok(c) => c,
                 Err(e) => {
-                    eprintln!("Failed to spawn cce-filesystem-interface: {:?}", e);
+                    eprintln!("Failed to spawn cce-files: {:?}", e);
                     return;
                 }
             };
@@ -1543,7 +1543,7 @@ impl State {
             let output = match child.wait_with_output() {
                 Ok(o) => o,
                 Err(e) => {
-                    eprintln!("Failed to wait for cce-filesystem-interface: {:?}", e);
+                    eprintln!("Failed to wait for cce-files: {:?}", e);
                     return;
                 }
             };
@@ -1581,34 +1581,34 @@ impl State {
 
             // Find executable path
             let exe_path = if let Ok(cur_exe) = std::env::current_exe() {
-                let sibling = cur_exe.with_file_name("cce-filesystem-interface");
+                let sibling = cur_exe.with_file_name("cce-files");
                 if sibling.exists() {
                     sibling
                 } else if let Ok(home) = std::env::var("HOME") {
                     let path = std::path::PathBuf::from(home)
                         .join(".local")
                         .join("bin")
-                        .join("cce-filesystem-interface");
+                        .join("cce-files");
                     if path.exists() {
                         path
                     } else {
-                        std::path::PathBuf::from("cce-filesystem-interface")
+                        std::path::PathBuf::from("cce-files")
                     }
                 } else {
-                    std::path::PathBuf::from("cce-filesystem-interface")
+                    std::path::PathBuf::from("cce-files")
                 }
             } else if let Ok(home) = std::env::var("HOME") {
                 let path = std::path::PathBuf::from(home)
                     .join(".local")
                     .join("bin")
-                    .join("cce-filesystem-interface");
+                    .join("cce-files");
                 if path.exists() {
                     path
                 } else {
-                    std::path::PathBuf::from("cce-filesystem-interface")
+                    std::path::PathBuf::from("cce-files")
                 }
             } else {
-                std::path::PathBuf::from("cce-filesystem-interface")
+                std::path::PathBuf::from("cce-files")
             };
 
             let child = match Command::new(exe_path)
@@ -1618,7 +1618,7 @@ impl State {
             {
                 Ok(c) => c,
                 Err(e) => {
-                    eprintln!("Failed to spawn cce-filesystem-interface: {:?}", e);
+                    eprintln!("Failed to spawn cce-files: {:?}", e);
                     return;
                 }
             };
@@ -1626,7 +1626,7 @@ impl State {
             let output = match child.wait_with_output() {
                 Ok(o) => o,
                 Err(e) => {
-                    eprintln!("Failed to wait for cce-filesystem-interface: {:?}", e);
+                    eprintln!("Failed to wait for cce-files: {:?}", e);
                     return;
                 }
             };
@@ -2131,7 +2131,7 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
             window.set_min_size(Some((200, 200)));
         } else {
             window.set_title("Clear Design Interface");
-            window.set_app_id("cce-design-interface");
+            window.set_app_id("cce-designer");
             window.set_min_size(Some((480, 320)));
         }
         window.commit();
@@ -3000,24 +3000,23 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
 
     pub fn update_inertial_settings(&mut self) {
         self.last_config_read = Instant::now();
-        let config_path = "/home/lsgalante/.config/cce/config.json";
+        let config_path = "/home/lsgalante/.config/cce/config.kdl";
         
         let mut enabled = true;
         let mut friction = 0.90;
         let mut speed = 1.0;
 
         if let Ok(content) = std::fs::read_to_string(config_path) {
-            if let Ok(val) = serde_json::from_str::<serde_json::Value>(&content) {
-                if let Some(inertial) = val.get("inertial") {
-                    if let Some(val) = inertial.get("inertial_scroll").and_then(|v| v.as_bool()) {
-                        enabled = val;
-                    }
-                    if let Some(friction_val) = inertial.get("scroll_friction").and_then(|v| v.as_i64()) {
-                        friction = (friction_val as f32 / 1000.0).clamp(0.1, 0.999);
-                    }
-                    if let Some(speed_val) = inertial.get("scroll_speed").and_then(|v| v.as_f64()) {
-                        speed = speed_val as f32;
-                    }
+            let val = cce_ui::config::parse_kdl_to_json(&content);
+            if let Some(inertial) = val.get("inertial") {
+                if let Some(val) = inertial.get("inertial_scroll").and_then(|v| v.as_bool()) {
+                    enabled = val;
+                }
+                if let Some(friction_val) = inertial.get("scroll_friction").and_then(|v| v.as_i64()) {
+                    friction = (friction_val as f32 / 1000.0).clamp(0.1, 0.999);
+                }
+                if let Some(speed_val) = inertial.get("scroll_speed").and_then(|v| v.as_f64()) {
+                    speed = speed_val as f32;
                 }
             }
         }
@@ -3029,8 +3028,8 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
 
     pub fn update_graph_settings_from_config(&mut self) {
         let config_paths = [
-            "/home/lsgalante/.config/cce/config.json",
-            "/home/lsgalante/.config/ccec/config.json",
+            "/home/lsgalante/.config/cce/config.kdl",
+            "/home/lsgalante/.config/ccec/config.kdl",
         ];
         
         let mut show_grid = None;
@@ -3042,16 +3041,15 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
 
         for path in &config_paths {
             if let Ok(content) = std::fs::read_to_string(path) {
-                if let Ok(val) = serde_json::from_str::<serde_json::Value>(&content) {
-                    if let Some(layout) = val.get("layout") {
-                        show_grid = layout.get("graph_show_grid").and_then(|v| v.as_bool());
-                        snap_enabled = layout.get("graph_snap_enabled").and_then(|v| v.as_bool());
-                        uniform_background = layout.get("graph_uniform_background").and_then(|v| v.as_bool());
-                        network_opacity = layout.get("graph_network_opacity").and_then(|v| v.as_f64()).map(|n| n as f32);
-                        cell_opacity = layout.get("graph_cell_opacity").and_then(|v| v.as_f64()).map(|n| n as f32).or(network_opacity);
-                        gap_opacity = layout.get("graph_gap_opacity").and_then(|v| v.as_f64()).map(|n| n as f32).or(network_opacity);
-                        break;
-                    }
+                let val = cce_ui::config::parse_kdl_to_json(&content);
+                if let Some(layout) = val.get("layout") {
+                    show_grid = layout.get("graph_show_grid").and_then(|v| v.as_bool());
+                    snap_enabled = layout.get("graph_snap_enabled").and_then(|v| v.as_bool());
+                    uniform_background = layout.get("graph_uniform_background").and_then(|v| v.as_bool());
+                    network_opacity = layout.get("graph_network_opacity").and_then(|v| v.as_f64()).map(|n| n as f32);
+                    cell_opacity = layout.get("graph_cell_opacity").and_then(|v| v.as_f64()).map(|n| n as f32).or(network_opacity);
+                    gap_opacity = layout.get("graph_gap_opacity").and_then(|v| v.as_f64()).map(|n| n as f32).or(network_opacity);
+                    break;
                 }
             }
         }
@@ -5120,8 +5118,8 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
         if now.duration_since(self.last_config_read).as_secs_f32() > 2.0 {
             self.last_config_read = now;
             let config_paths = [
-                "/home/lsgalante/.config/cce/config.json",
-                "/home/lsgalante/.config/ccec/config.json",
+                "/home/lsgalante/.config/cce/config.kdl",
+                "/home/lsgalante/.config/ccec/config.kdl",
             ];
             let mut current_mod_time = None;
             for path in &config_paths {
diff --git a/src/project.rs b/src/project.rs
index 7d22da8..79a5141 100644
--- a/src/project.rs
+++ b/src/project.rs
@@ -54,7 +54,8 @@ impl State {
         std::env::var("HOME").ok().map(|h| {
             let mut path = std::path::PathBuf::from(h);
             path.push(".config");
-            path.push("cce-design-interface");
+            path.push("cce");
+            path.push("cce-designer");
             path.push("recent_files.json");
             path
         })
diff --git a/src/window.rs b/src/window.rs
index 8ecfa39..cd27b93 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -659,7 +659,7 @@ impl wayland_client::Dispatch<cce_ui::protocol::zcce_inspector_v1::ZcceInspector
                     let expected_id = if st.is_detached_network {
                         "circular-network-pane"
                     } else {
-                        "cce-design-interface"
+                        "cce-designer"
                     };
                     if app_id == expected_id {
                         st.window_x = x;